/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    /* Reserve space for vertical scrollbar to prevent horizontal shift when content height changes */
    overflow-y: scroll;
}

body {
    line-height: 1.6;
    color: var(--sa-text-primary);
    overflow-x: hidden;
    background-color: var(--sa-bg) !important;
}

/* Ensure the page base uses theme colors */
html, body { background: var(--sa-bg-gradient) !important; }

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

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--sa-chrome);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--sa-chrome-contrast);
    border-bottom: 1px solid var(--sa-chrome-border);
    z-index: 1000;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-logo .logo-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--sa-chrome-contrast);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-link {
    text-decoration: none;
    color: var(--sa-chrome-contrast);
    font-weight: 500;
    transition: color 0.2s ease;
    position: relative;
}

.nav-link:hover {
    color: var(--sa-accent);
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background: var(--sa-accent);
    transition: width 0.2s ease;
}

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

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.bar {
    width: 25px;
    height: 3px;
    background: var(--sa-chrome-contrast);
    margin: 3px 0;
    transition: 0.3s;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    background: transparent; /* Let the body gradient show through */
    overflow: hidden;
}

.hero-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.hero-text {
    z-index: 2;
}

.greeting {
    display: block;
    font-size: 24px;
    color: var(--sa-accent);
    font-weight: 500;
    margin-bottom: 10px;
}

.name {
    display: block;
    font-size: 56px;
    font-weight: 700;
    color: var(--sa-text-primary);
    margin-bottom: 20px;
}

.hero-subtitle {
    font-size: 28px;
    color: var(--sa-text-secondary);
    margin-bottom: 30px;
    min-height: 40px;
}

.typing-text {
    font-weight: 600;
}

.cursor {
    animation: blink 1s infinite;
    color: var(--sa-accent);
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.hero-description {
    font-size: 18px;
    color: var(--sa-text-secondary);
    margin-bottom: 40px;
    line-height: 1.8;
}

.hero-buttons {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 16px;
}

.btn-primary {
    background: var(--sa-accent);
    color: var(--sa-accent-contrast);
    box-shadow: 0 10px 30px rgba(213, 63, 140, 0.2);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(213, 63, 140, 0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--sa-accent);
    border: 2px solid var(--sa-accent);
}

.btn-secondary:hover {
    background: var(--sa-accent);
    color: var(--sa-accent-contrast);
    transform: translateY(-3px);
}

.social-links {
    display: flex;
    gap: 20px;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: var(--sa-surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--sa-accent);
    text-decoration: none;
    border-radius: 50%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.social-link:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(213, 63, 140, 0.2);
    background: var(--sa-accent);
    color: var(--sa-accent-contrast);
}

/* Hero Image */
.hero-image {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-container {
    position: relative;
    width: 400px;
    height: 400px;
}

.profile-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 5px solid var(--sa-surface);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    z-index: 2;
    position: relative;
}

.image-bg {
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background: var(--sa-accent);
    border-radius: 50%;
    z-index: 1;
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.floating-elements {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.floating-element {
    position: absolute;
    width: 60px;
    height: 60px;
    background: var(--sa-surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--sa-accent);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    animation: float 6s ease-in-out infinite;
}

.element-1 {
    top: 10%;
    right: 10%;
    animation-delay: 0s;
}

.element-2 {
    bottom: 20%;
    left: 0%;
    animation-delay: 1.5s;
}

.element-3 {
    top: 60%;
    right: -10%;
    animation-delay: 3s;
}

.element-4 {
    top: 20%;
    left: -10%;
    animation-delay: 4.5s;
}

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

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.scroll-arrow {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--sa-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sa-accent);
    animation: bounce 2s infinite;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,.1);
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* Background Shapes */
.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 0;
}

.bg-shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(213, 63, 140, 0.06); /* soft magenta */
}

.shape-1 {
    width: 300px;
    height: 300px;
    top: 10%;
    right: -150px;
    animation: float 8s ease-in-out infinite;
}

.shape-2 {
    width: 200px;
    height: 200px;
    bottom: 20%;
    left: -100px;
    animation: float 6s ease-in-out infinite reverse;
}

.shape-3 {
    width: 150px;
    height: 150px;
    top: 50%;
    left: 10%;
    animation: float 10s ease-in-out infinite;
}

/* Section Styles */
section {
    padding: 100px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 80px;
}

.section-title {
    font-size: 48px;
    font-weight: 700;
    color: var(--sa-text-primary);
    margin-bottom: 20px;
}

/* Ensure the stack section title never moves */
#stack-title {
    animation: none !important;
    transition: none !important;
    position: relative;
    display: block;
    text-align: center;
}

/* Pin the stack section title to a fixed center to avoid horizontal jitter */
#stack .section-header {
    position: relative;
    /* Reserve space for the absolutely positioned title */
    padding-top: 60px;
    /* Use block layout to avoid grid/flex subpixel rounding jitter */
    display: block;
    text-align: center;
    width: 100%;
}

#stack .section-header #stack-title {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateZ(0);
    margin: 0;
    width: auto;
    /* Rendering stability hints */
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Prevent the tech orbit section from affecting page width */
#stack {
    overflow: hidden;
}

.section-subtitle {
    font-size: 20px;
    color: var(--sa-text-secondary);
}

/* About Section */
.about {
    background: var(--sa-surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: start;
}

.about-text h3 {
    font-size: 32px;
    color: var(--sa-text-primary);
    margin-bottom: 30px;
}

.about-text p {
    font-size: 18px;
    color: var(--sa-text-secondary);
    margin-bottom: 25px;
    line-height: 1.8;
}

.stats {
    display: flex;
    gap: 40px;
    margin-top: 40px;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 36px;
    font-weight: 700;
    color: var(--sa-accent);
    margin-bottom: 10px;
}

.stat-label {
    font-size: 14px;
    color: var(--sa-text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.about-skills h3 {
    font-size: 32px;
    color: var(--sa-text-primary);
    margin-bottom: 30px;
}

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

.skill-card {
    background: var(--sa-bg);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    transition: transform 0.3s ease;
    border: 1px solid var(--sa-surface-border);
}

.skill-card:hover {
    transform: translateY(-10px);
}

.skill-icon {
    width: 60px;
    height: 60px;
    background: var(--sa-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: var(--sa-accent-contrast);
    font-size: 24px;
}

.skill-card h4 {
    font-size: 20px;
    color: var(--sa-text-primary);
    margin-bottom: 15px;
}

.skill-card p {
    color: var(--sa-text-secondary);
    line-height: 1.6;
}

/* Skills Section */
.skills {
    background: transparent;
}

.skills-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 50px;
}

.skill-category h3 {
    font-size: 24px;
    color: var(--sa-text-primary);
    margin-bottom: 30px;
    text-align: center;
}

.skill-items {
    display: grid;
    gap: 20px;
}

.skill-item {
    background: var(--sa-surface);
    padding: 20px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--sa-surface-border);
    transition: transform 0.3s ease;
}

.skill-item:hover {
    transform: translateY(-5px);
}

.skill-item i {
    font-size: 24px;
    color: var(--sa-accent);
}

.skill-item span {
    font-weight: 600;
    color: var(--sa-text-primary);
}

/* Projects Section */
.projects {
    background: var(--sa-surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 40px;
}

.project-card {
    background: var(--sa-bg);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.07);
    border: 1px solid var(--sa-surface-border);
    transition: transform 0.3s ease;
}

.project-card:hover {
    transform: translateY(-10px);
}

.project-image {
    height: 250px;
    background: var(--sa-surface);
    position: relative;
    overflow: hidden;
}

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.project-links {
    display: flex;
    gap: 20px;
}

.project-link {
    width: 50px;
    height: 50px;
    background: var(--sa-surface);
    color: var(--sa-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.project-link:hover {
    transform: scale(1.1);
}

.project-content {
    padding: 30px;
}

.project-content h3 {
    font-size: 24px;
    color: var(--sa-text-primary);
    margin-bottom: 15px;
}

.project-content p {
    color: var(--sa-text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.project-tech {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tech-tag {
    background: var(--sa-accent);
    color: var(--sa-accent-contrast);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

/* Contact Section */
.contact {
    background: transparent;
    color: var(--sa-text-primary);
}

.contact .section-title {
    color: inherit;
    -webkit-text-fill-color: initial;
}

.contact .section-subtitle {
    color: var(--sa-text-secondary);
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: start;
}

.contact-info h3 {
    font-size: 32px;
    margin-bottom: 30px;
    color: var(--sa-text-primary);
}

.contact-info p {
    font-size: 18px;
    line-height: 1.8;
    margin-bottom: 40px;
    color: var(--sa-text-secondary);
}

.contact-details {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 16px;
}

.contact-item i {
    width: 20px;
    color: var(--sa-accent);
}

.contact-form {
    background: var(--sa-surface);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid var(--sa-surface-border);
}

.form-group {
    margin-bottom: 25px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 15px 20px;
    border: 1px solid var(--sa-surface-border);
    border-radius: 10px;
    background: var(--sa-bg);
    color: var(--sa-text-primary);
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    background: var(--sa-surface);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.07);
    border-color: var(--sa-accent);
}

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

/* Footer */
.footer {
    background: var(--sa-chrome);
    color: var(--sa-chrome-contrast);
    padding: 40px 0;
    text-align: center;
    border-top: 1px solid var(--sa-chrome-border);
}

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

.footer-links {
    display: flex;
    gap: 30px;
}

.footer-links a {
    color: var(--sa-accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--sa-accent);
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: var(--sa-chrome);
        color: var(--sa-chrome-contrast);
        width: 100%;
        text-align: center;
        transition: left 0.3s ease;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.25);
        padding: 20px 0;
        border-top: 1px solid var(--sa-chrome-border);
    }
    
    .nav-menu.active { left: 0; }
    .nav-menu .nav-link { color: var(--sa-chrome-contrast); }
    
    .hero-content {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }
    
    .name {
        font-size: 40px;
    }
    
    .hero-subtitle {
        font-size: 20px;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .about-content {
        grid-template-columns: 1fr;
        gap: 50px;
    }
    
    .skills-container {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .skills-grid {
        grid-template-columns: 1fr;
    }
    
    .stats {
        justify-content: center;
        gap: 30px;
    }
    
    .contact-content {
        grid-template-columns: 1fr;
        gap: 50px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 20px;
    }
    
    .image-container {
        width: 300px;
        height: 300px;
    }
    
    .floating-element {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .section-title {
        font-size: 36px;
    }
    
    .name {
        font-size: 32px;
    }
    
    .hero-subtitle {
        font-size: 18px;
    }
    
    .btn {
        padding: 12px 25px;
        font-size: 14px;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .image-container {
        width: 250px;
        height: 250px;
    }
}
