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

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 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);
    --max-width: 1200px;
    --spacing-unit: 1rem;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

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

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

/* Animation classes */
.fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

.fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

.slide-in-left {
    animation: slideInLeft 0.8s ease-out forwards;
}

.slide-in-right {
    animation: slideInRight 0.8s ease-out forwards;
}

/* Initial hidden state for scroll animations */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}


.scroll-reveal-delay-1 {
    transition-delay: 0.1s;
}

.scroll-reveal-delay-2 {
    transition-delay: 0.2s;
}

.scroll-reveal-delay-3 {
    transition-delay: 0.3s;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    font-size: 16px;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ============================================
   Navigation
   ============================================ */
.navbar {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95);
    transition: all 0.3s ease;
    animation: fadeIn 0.6s ease-out;
}

.navbar.scrolled {
    box-shadow: var(--shadow-md);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: transform 0.3s ease;
}

.nav-brand:hover {
    transform: scale(1.05);
}

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

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

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

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

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-color);
}

/* Mobile Navigation */
@media (max-width: 768px) {
    .nav-links {
        gap: 1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 640px) {
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem;
    }
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
    padding: 6rem 0 4rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(147, 51, 234, 0.05) 50%, rgba(59, 130, 246, 0.05) 100%);
    background-size: 200% 200%;
    animation: gradientShift 20s ease infinite;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.98), rgba(249, 250, 251, 1));
    z-index: 1;
}

.hero .container {
    position: relative;
    z-index: 2;
}

.hero-name {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    animation: fadeInUp 1s ease-out 0.2s both;
    background: linear-gradient(135deg, var(--text-primary), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-role {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--primary-color);
    margin-bottom: 1rem;
    animation: fadeInUp 1s ease-out 0.4s both;
}

.hero-tagline {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2rem;
    animation: fadeInUp 1s ease-out 0.6s both;
}

.hero-links {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    animation: fadeInUp 1s ease-out 0.8s both;
}

@media (max-width: 640px) {
    .hero {
        padding: 4rem 0 3rem;
    }
    
    .hero-name {
        font-size: 2rem;
    }
    
    .hero-role {
        font-size: 1.25rem;
    }
    
    .hero-tagline {
        font-size: 1rem;
    }
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-lg);
}

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

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-md);
}

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

.section-alt {
    background-color: var(--bg-secondary);
}

.section-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
    border-radius: 2px;
    animation: slideInLeft 0.8s ease-out 0.3s both;
}

@media (max-width: 640px) {
    .section {
        padding: 3rem 0;
    }
    
    .section-title {
        font-size: 1.75rem;
    }
}

/* ============================================
   About Section
   ============================================ */
.about-content {
    max-width: 800px;
    margin: 0 auto;
}

.about-content p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    font-size: 1.0625rem;
    line-height: 1.8;
}

.about-content p:last-child {
    margin-bottom: 0;
}

/* ============================================
   Projects Section
   ============================================ */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.project-card {
    background-color: var(--bg-primary);
    padding: 2rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.1), transparent);
    transition: left 0.5s ease;
}

.project-card:hover::before {
    left: 100%;
}

.project-card:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-8px) scale(1.02);
    border-color: var(--primary-color);
}

.project-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.project-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    flex-grow: 1;
    line-height: 1.7;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tech-tag {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tech-tag:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.project-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.project-link:hover {
    color: var(--primary-dark);
    transform: translateX(5px);
    gap: 0.75rem;
}

.projects-note {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: -1rem auto 2rem;
    max-width: 640px;
    line-height: 1.6;
}

.projects-note a {
    color: var(--primary-color);
    font-weight: 500;
    text-decoration: none;
}

.projects-note a:hover {
    text-decoration: underline;
}

@media (max-width: 640px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Skills Section
   ============================================ */
.skills-content {
    max-width: 900px;
    margin: 0 auto;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

.skills-category {
    margin-bottom: 2.5rem;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

.skills-category:last-child {
    margin-bottom: 0;
}

.skills-category-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    opacity: 1 !important;
    visibility: visible !important;
}

.skills-tags {
    display: flex !important;
    flex-wrap: wrap;
    gap: 0.75rem;
    opacity: 1 !important;
    visibility: visible !important;
}

.skill-tag {
    display: inline-block !important;
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    opacity: 1 !important;
    visibility: visible !important;
    animation: fadeInUp 0.6s ease-out both;
}

.skill-tag:nth-child(1) { animation-delay: 0.1s; }
.skill-tag:nth-child(2) { animation-delay: 0.2s; }
.skill-tag:nth-child(3) { animation-delay: 0.3s; }
.skill-tag:nth-child(4) { animation-delay: 0.4s; }
.skill-tag:nth-child(5) { animation-delay: 0.5s; }
.skill-tag:nth-child(6) { animation-delay: 0.6s; }

.skill-tag:hover {
    transform: translateY(-4px) scale(1.1);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

/* ============================================
   Resume Section
   ============================================ */
.resume-content {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.resume-content p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1.0625rem;
}

.resume-note {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ============================================
   Contact Section
   ============================================ */
.contact-content {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.contact-content > p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.0625rem;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.0625rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    min-width: 200px;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.contact-link::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: var(--primary-color);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
    z-index: 0;
}

.contact-link:hover::before {
    width: 300px;
    height: 300px;
}

.contact-link span {
    position: relative;
    z-index: 1;
    transition: color 0.3s ease;
}

.contact-link:hover {
    background-color: var(--bg-secondary);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-lg);
}

.contact-link:hover .contact-icon {
    transform: scale(1.2) rotate(5deg);
}

.contact-icon {
    font-size: 1.25rem;
    transition: transform 0.3s ease;
}

/* ============================================
   Footer
   ============================================ */
.footer {
    background-color: var(--text-primary);
    color: white;
    padding: 2rem 0;
    text-align: center;
}

.footer p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

/* ============================================
   Utility Classes
   ============================================ */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* ============================================
   Case studies
   ============================================ */
#case-studies .section-title {
    display: block;
    text-align: center;
}

.case-studies-lead {
    text-align: center;
    color: var(--text-secondary);
    max-width: 720px;
    margin: -0.5rem auto 2.5rem;
    font-size: 1.0625rem;
    line-height: 1.7;
}

.case-study {
    max-width: 880px;
    margin: 0 auto 3.5rem;
    padding: 2rem 2rem 2.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.case-study:last-of-type {
    margin-bottom: 0;
}

.case-study-alt {
    background: var(--bg-secondary);
}

.case-study-kicker {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.case-study-title {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.25;
    margin-bottom: 0.35rem;
}

.case-study-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.case-study-heading {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.5rem 0 0.65rem;
}

.case-study-body {
    color: var(--text-secondary);
    font-size: 1.0625rem;
    line-height: 1.75;
    margin-bottom: 0.25rem;
}

.case-study-list {
    margin: 0.75rem 0 0 1.25rem;
    color: var(--text-secondary);
    font-size: 1.0625rem;
    line-height: 1.75;
}

.case-study-list li {
    margin-bottom: 0.5rem;
}

.inline-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
    background: var(--bg-secondary);
    padding: 0.12rem 0.35rem;
    border-radius: 0.25rem;
    border: 1px solid var(--border-color);
}

.architecture-figure {
    margin: 1rem 0 0.5rem;
}

.architecture-diagram {
    background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
    border: 1px solid var(--border-color);
    border-radius: 0.65rem;
    padding: 1rem;
    overflow-x: auto;
}

.architecture-diagram--tall {
    max-width: 440px;
    margin: 0 auto;
}

.architecture-diagram svg {
    display: block;
    width: 100%;
    height: auto;
    min-width: 520px;
}

.architecture-diagram--tall svg {
    min-width: 0;
}

.architecture-caption {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.65rem;
    line-height: 1.5;
}

.case-study-visual {
    margin: 1.25rem 0;
}

.case-study-screenshot {
    display: block;
    width: 100%;
    max-width: 960px;
    height: auto;
    margin: 0 auto;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.case-study-visual-fallback {
    background: var(--bg-secondary);
    border: 1px dashed var(--border-color);
    border-radius: 0.65rem;
    padding: 1.25rem 1.5rem;
    color: var(--text-secondary);
}

.case-study-visual-fallback[hidden] {
    display: none !important;
}

.fallback-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.fallback-note {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.metric-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.metric-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.metric-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.case-study-visual--split {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 768px) {
    .case-study-visual--split {
        grid-template-columns: 1fr;
    }
}

.screenshot-block {
    margin: 0;
}

.screenshot-block figcaption {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    text-align: center;
}

.case-study-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    margin-top: 1.75rem;
    max-width: 520px;
}

.btn-cta-large {
    text-align: center;
    padding: 1rem 1.5rem;
    font-size: 1.05rem;
    font-weight: 600;
}

@media (min-width: 640px) {
    .case-study-actions {
        max-width: none;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .btn-cta-large {
        flex: 1 1 240px;
    }
}
