@import url('https://fonts.googleapis.com/css2?family=Delius&display=swap');

:root {
    /* Light Mode (Default) */
    --background: oklch(0.98 0 0);
    --foreground: oklch(0.15 0 0);
    --card: oklch(1 0 0);
    --card-foreground: oklch(0.15 0 0);
    --primary: oklch(0.45 0 0);
    --primary-foreground: oklch(1 0 0);
    --secondary: oklch(0.96 0 0);
    --secondary-foreground: oklch(0.15 0 0);
    --muted: oklch(0.92 0 0);
    --muted-foreground: oklch(0.40 0 0);
    --accent: oklch(0.92 0 0);
    --accent-foreground: oklch(0.15 0 0);
    --border: oklch(0.92 0 0);
    --ring: oklch(0.15 0 0);

    --font-heading: 'Delius', cursive;
    --font-body: 'Delius', cursive;
    --radius: 0.75rem;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
}

/* Dark Mode Overrides */
:root.dark {
    --background: oklch(0.12 0 0);
    --foreground: oklch(0.98 0 0);
    --card: oklch(0.15 0 0);
    --card-foreground: oklch(0.98 0 0);
    --primary: oklch(0.90 0 0);
    --primary-foreground: oklch(0.12 0 0);
    --secondary: oklch(0.20 0 0);
    --secondary-foreground: oklch(0.98 0 0);
    --muted: oklch(0.20 0 0);
    --muted-foreground: oklch(0.65 0 0);
    --accent: oklch(0.25 0 0);
    --accent-foreground: oklch(0.98 0 0);
    --border: oklch(0.22 0 0);
    --ring: oklch(0.85 0 0);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html.lenis {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto;
}

html {
    scroll-behavior: smooth;
    /* Fallback */
    scroll-padding-top: 5rem;
}

body {
    font-family: var(--font-body);
    background: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--foreground);
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--muted);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Navigation */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 6%;
    background: var(--background);
    /* Changed from card to match body or specified theme */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    background: color-mix(in srgb, var(--background), transparent 20%);
    transition: all 0.3s ease;
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
    font-family: var(--font-heading);
}

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

.nav-links a {
    color: var(--muted-foreground);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: color 0.2s ease;
    cursor: pointer;
    position: relative;
    padding: 0.5rem 0;
}

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

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

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

.nav-cta {
    padding: 0.75rem 1.75rem;
    background: oklch(0.45 0 0);
    color: #ffffff;
    border-radius: 9999px;
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    font-family: var(--font-heading);
    box-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.2);
    letter-spacing: 0.01em;
}

.nav-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    filter: brightness(1.2);
    color: #ffffff;
}

.nav-links a.nav-cta::after {
    display: none;
}

/* Theme Toggle */
.theme-toggle {
    background: transparent;
    border: none;
    color: var(--foreground);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-left: 1rem;
    transition: background 0.2s;
}

.theme-toggle:hover {
    background: var(--secondary);
}

.theme-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
    transition: transform 0.5s ease;
}

.sun-icon {
    display: none;
}

.moon-icon {
    display: block;
}

:root.dark .sun-icon {
    display: block;
}

:root.dark .moon-icon {
    display: none;
}

/* Hamburger */
.hamburger {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    gap: 6px;
    flex-direction: column;
    justify-content: center;
    width: 30px;
    height: 30px;
    z-index: 101;
}

.hamburger span {
    width: 100%;
    height: 2px;
    background: var(--foreground);
    transition: all 0.3s ease;
}

/* Sections */
section {
    padding: 6rem 6%;
}

.section-title {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--foreground);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.section-subtitle {
    color: var(--primary);
    margin-bottom: 3rem;
    font-size: 1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

/* Animation Utilities */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Hero */
#home {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 5rem;
    position: relative;
    overflow: hidden;
}

#home::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--secondary) 0%, transparent 70%);
    opacity: 0.5;
    z-index: -1;
}

.hero-container {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--foreground);
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.hero-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 10px #22c55e;
    animation: pulse 2s infinite;
}

.hero-content h1 {
    font-size: 4.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    letter-spacing: -0.03em;
}

.hero-title-typing {
    color: var(--primary);
    position: relative;
    display: inline-block;
}

.typing-cursor {
    display: inline-block;
    width: 3px;
    height: 1em;
    background: var(--primary);
    margin-left: 4px;
    animation: blink 1s infinite;
    vertical-align: sub;
}

.hero-content p {
    font-size: 1.25rem;
    color: var(--muted-foreground);
    margin-bottom: 2.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-primary {
    padding: 1rem 2.5rem;
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    padding: 1rem 2.5rem;
    background: transparent;
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--secondary);
    border-color: var(--secondary);
}

/* About & Services Grid (Reused style) */
.about-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
}

.about-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.about-tag {
    padding: 0.5rem 1rem;
    background: var(--secondary);
    border-radius: 2rem;
    font-size: 0.875rem;
    color: var(--foreground);
    font-weight: 500;
    transition: background 0.2s;
}

.about-tag:hover {
    background: var(--border);
}

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

.skill-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.skill-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.skill-card h3 {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.skill-item {
    margin-bottom: 1.25rem;
}

.skill-item:last-child {
    margin-bottom: 0;
}

.skill-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.skill-bar {
    height: 8px;
    background: var(--secondary);
    border-radius: 4px;
    overflow: hidden;
}

.skill-progress {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.skill-card:hover .skill-progress,
.skill-progress.visible {
    transform: scaleX(1);
    /* Width is handled inline style, checks parent intersection */
}


/* Projects */
.filter-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1.5rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 2rem;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.project-card {
    background: var(--card);
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-card.hidden {
    display: none;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.project-image {
    height: 200px;
    background: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.project-placeholder {
    color: var(--muted-foreground);
    font-weight: 500;
}

.project-content {
    padding: 1.5rem;
}

.project-content h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.project-content p {
    color: var(--muted-foreground);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.project-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.project-tags span {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: var(--background);
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: 4px;
}

/* Timeline/Experience */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background: var(--border);
}

.timeline-item {
    width: 50%;
    padding: 0 3rem 3rem;
    position: relative;
}

.timeline-item:nth-child(odd) {
    left: 0;
    text-align: right;
}

.timeline-item:nth-child(even) {
    left: 50%;
    text-align: left;
}

.timeline-dot {
    width: 16px;
    height: 16px;
    background: var(--background);
    border: 3px solid var(--primary);
    border-radius: 50%;
    position: absolute;
    top: 5px;
    right: -8px;
    z-index: 2;
    transition: transform 0.3s ease;
}

.timeline-item:nth-child(even) .timeline-dot {
    left: -8px;
    right: auto;
}

.timeline-item:hover .timeline-dot {
    transform: scale(1.5);
    background: var(--primary);
}

.timeline-date {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--secondary);
    color: var(--foreground);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 1rem;
    margin-bottom: 0.75rem;
}

.timeline-content h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.timeline-content p {
    color: var(--muted-foreground);
    font-size: 0.95rem;
}

/* Contact */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 4rem;
}

.contact-card,
.form-card {
    background: var(--card);
    padding: 2.5rem;
    border-radius: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.contact-feature {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.contact-feature-icon {
    width: 3rem;
    height: 3rem;
    background: var(--secondary);
    color: var(--primary);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.contact-feature-icon svg {
    width: 1.5rem;
    height: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 1rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    font-family: inherit;
    color: var(--foreground);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--secondary);
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.submit-btn:hover {
    opacity: 0.9;
}

.error-message {
    color: #ef4444;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    display: none;
}

.form-group.error input,
.form-group.error textarea {
    border-color: #ef4444;
}

.form-group.error .error-message {
    display: block;
}

/* Scroll To Top */
.scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3rem;
    height: 3rem;
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 90;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    transform: translateY(-2px);
}

.scroll-to-top svg {
    width: 1.5rem;
    height: 1.5rem;
}

/* Footer */
footer {
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 4rem 6% 2rem;
    margin-top: 4rem;
}

.footer-bottom {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    color: var(--muted-foreground);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 968px) {
    .contact-grid {
        grid-template-columns: 1fr;
    }

    .hero-content h1 {
        font-size: 3.5rem;
    }
}

@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 73px;
        left: 0;
        width: 100%;
        background: var(--background);
        flex-direction: column;
        align-items: flex-start;
        padding: 2rem 6%;
        border-bottom: 1px solid var(--border);
        transform: translateY(-150%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        gap: 1.5rem;
        box-shadow: var(--shadow-md);
    }

    .nav-links.active {
        transform: translateY(0);
    }

    .timeline::before {
        left: 0;
    }

    .timeline-item {
        width: 100%;
        padding-left: 2rem;
        padding-right: 0;
    }

    .timeline-item:nth-child(even),
    .timeline-item:nth-child(odd) {
        left: 0;
        text-align: left;
    }

    .timeline-dot {
        left: -7px;
        right: auto !important;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

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