:root {
    --bg: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --card: #f8fafc;
    --accent: #2563eb;
    --border: #e2e8f0;
}

[data-theme="dark"] {
    --bg: #0b1220;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --card: #111827;
    --accent: #3b82f6;
    --border: #1e293b;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background .4s ease, color .4s ease;
    overflow-x: hidden;
}

/* Animated Gradient Background */
body::before {
    content: "";
    position: fixed;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(37,99,235,0.15), transparent 60%);
    top: -200px;
    right: -200px;
    animation: float 12s ease-in-out infinite alternate;
    z-index: -1;
}

@keyframes float {
    from { transform: translateY(0px); }
    to   { transform: translateY(60px); }
}

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

/* =============================
   HEADER
============================= */
.header {
    padding: 18px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    background: rgba(255,255,255,0.75);
    border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .header {
    background: rgba(11,18,32,0.75);
}

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

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo-img {
    height: 36px;
    width: auto;
    display: block;
}

.logo-dark { display: none; }

[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark  { display: block; }

nav a {
    margin: 0 14px;
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    position: relative;
    transition: color 0.2s;
}

nav a::after {
    content: "";
    position: absolute;
    width: 0%;
    height: 2px;
    left: 0;
    bottom: -4px;
    background: var(--accent);
    transition: width 0.3s ease;
}

nav a:hover::after {
    width: 100%;
}

#themeToggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 15px;
    transition: border-color 0.2s, background 0.2s;
    line-height: 1;
}

#themeToggle:hover {
    border-color: var(--accent);
    background: rgba(37,99,235,0.06);
}

/* =============================
   HAMBURGER BUTTON
============================= */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    width: 38px;
    height: 38px;
    transition: border-color 0.2s;
}

.menu-toggle:hover {
    border-color: var(--accent);
}

.menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.menu-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.menu-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =============================
   MOBILE NAV DRAWER
============================= */
.nav-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.nav-drawer-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.nav-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    height: 100%;
    background: var(--bg);
    border-left: 1px solid var(--border);
    z-index: 200;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(.16, 1, .3, 1);
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.nav-drawer.open {
    transform: translateX(0);
}

.nav-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.drawer-close {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 16px;
    color: var(--text);
    line-height: 1;
    transition: border-color 0.2s, color 0.2s;
}

.drawer-close:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.drawer-nav {
    display: flex;
    flex-direction: column;
}

.drawer-nav a {
    text-decoration: none;
    color: var(--text);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.4px;
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
    transition: color 0.2s, padding-left 0.2s;
}

.drawer-nav a:first-child {
    border-top: 1px solid var(--border);
}

.drawer-nav a:hover {
    color: var(--accent);
    padding-left: 6px;
}

/* =============================
   HERO
============================= */
.hero {
    padding: 140px 0 120px;
    text-align: center;
}

.hero-greeting {
    font-size: 17px;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 18px;
    letter-spacing: 0.1px;
}

.hero-badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(37,99,235,0.08);
    color: var(--accent);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-bottom: 28px;
    border: 1px solid rgba(37,99,235,0.2);
}

.hero h1 {
    font-size: 56px;
    font-weight: 800;
    letter-spacing: -2px;
    line-height: 1.1;
    margin-bottom: 24px;
}

.hero-subtitle {
    font-size: 18px;
    color: var(--muted);
    line-height: 1.75;
    max-width: 580px;
    margin: 0 auto 36px;
}

.hero-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

/* =============================
   BUTTONS
============================= */
.btn {
    display: inline-block;
    padding: 14px 30px;
    background: var(--accent);
    color: #fff;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition: all .3s cubic-bezier(.16,1,.3,1);
}

.btn:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 15px 35px rgba(37,99,235,0.3);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1.5px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: none;
    background: rgba(37,99,235,0.05);
    transform: translateY(-4px) scale(1.03);
}

/* =============================
   SECTIONS
============================= */
.section {
    padding: 120px 0;
    opacity: 0;
    transform: translateY(60px);
}

.section-title {
    text-align: center;
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 16px;
}

.section-subtitle {
    text-align: center;
    font-size: 17px;
    color: var(--muted);
    margin-bottom: 60px;
    line-height: 1.6;
}

/* =============================
   ABOUT
============================= */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 64px;
    align-items: start;
    margin-top: 10px;
}

.about-text p {
    color: var(--muted);
    line-height: 1.9;
    font-size: 16px;
    margin-bottom: 18px;
}

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

.about-text strong {
    color: var(--text);
    font-weight: 600;
}

.about-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.stat {
    padding: 22px 16px;
    background: var(--card);
    border-radius: 14px;
    text-align: center;
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}

.stat:hover {
    border-color: rgba(37,99,235,0.3);
}

.stat-number {
    display: block;
    font-size: 20px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

/* =============================
   SKILLS
============================= */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 10px;
}

.skill-category {
    padding: 26px;
    background: var(--card);
    border-radius: 16px;
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}

.skill-category:hover {
    border-color: rgba(37,99,235,0.3);
}

.skill-category h4 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--accent);
    margin-bottom: 14px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    padding: 5px 12px;
    background: rgba(37,99,235,0.07);
    color: var(--text);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid rgba(37,99,235,0.14);
    transition: all 0.2s ease;
}

[data-theme="dark"] .tag {
    background: rgba(59,130,246,0.1);
    border-color: rgba(59,130,246,0.2);
}

/* =============================
   GRID
============================= */
.grid {
    display: grid;
    gap: 28px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* =============================
   CARDS
============================= */
.card {
    padding: 34px;
    background: var(--card);
    border-radius: 16px;
    text-decoration: none;
    color: var(--text);
    transition: all .4s cubic-bezier(.16,1,.3,1);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transform-style: preserve-3d;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 50px rgba(0,0,0,0.07);
    border-color: rgba(37,99,235,0.3);
}

[data-theme="dark"] .card:hover {
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

.card::before {
    content: "";
    position: absolute;
    width: 120%;
    height: 120%;
    background: radial-gradient(circle at top left, rgba(37,99,235,0.1), transparent 70%);
    top: -40%;
    left: -40%;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.card:hover::before {
    opacity: 1;
}

.card-number {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 1px;
    margin-bottom: 14px;
    opacity: 0.8;
}

.card h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.card p {
    font-size: 15px;
    color: var(--muted);
    line-height: 1.75;
    flex: 1;
    margin-bottom: 22px;
}

.card-company {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    opacity: 0.75;
    margin-bottom: 10px;
    letter-spacing: 0.2px;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
}

.card-tags .tag {
    font-size: 12px;
    padding: 4px 10px;
}

/* GitHub cards */
.github-label {
    display: inline-block;
    padding: 3px 10px;
    background: #24292e;
    color: #fff;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 14px;
}

[data-theme="dark"] .github-label {
    background: #30363d;
}

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

.contact-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 36px;
}

.social-links {
    display: flex;
    gap: 28px;
    justify-content: center;
    flex-wrap: wrap;
}

.social-links a {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
}

.social-links a::after {
    content: "";
    position: absolute;
    width: 0%;
    height: 1px;
    left: 0;
    bottom: -2px;
    background: var(--accent);
    transition: width 0.3s ease;
}

.social-links a:hover {
    color: var(--accent);
}

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

/* =============================
   FOOTER
============================= */
footer {
    padding: 36px 0;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 14px;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

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

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

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

/* =============================
   ANIMATED BACKGROUNDS
============================= */
.gradient-mesh {
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
            radial-gradient(at 20% 30%, rgba(37,99,235,0.2), transparent 60%),
            radial-gradient(at 80% 70%, rgba(139,92,246,0.2), transparent 60%);
    filter: blur(80px);
    animation: meshMove 20s ease-in-out infinite alternate;
}

@keyframes meshMove {
    0%   { transform: translateY(0px) scale(1); }
    100% { transform: translateY(-40px) scale(1.05); }
}

.mouse-glow {
    position: fixed;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(37,99,235,0.12), transparent 70%);
    transform: translate(-50%, -50%);
    z-index: -1;
    transition: left 0.08s ease, top 0.08s ease;
    opacity: 0;
}

/* =============================
   SCROLL ANIMATIONS
============================= */
.fade-up {
    opacity: 1;
    transform: translateY(40px);
    transition: all 1s cubic-bezier(.16,1,.3,1);
}

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

.delay-1 { transition-delay: .2s; }
.delay-2 { transition-delay: .4s; }
.delay-3 { transition-delay: .6s; }

/* =============================
   MARQUEE STRIP
============================= */
.marquee-strip {
    overflow: hidden;
    position: relative;
    padding: 18px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--card);
}

.marquee-strip::before,
.marquee-strip::after {
    content: "";
    position: absolute;
    top: 0;
    width: 140px;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.marquee-strip::before {
    left: 0;
    background: linear-gradient(to right, var(--card), transparent);
}

.marquee-strip::after {
    right: 0;
    background: linear-gradient(to left, var(--card), transparent);
}

.marquee-track {
    display: flex;
    align-items: center;
    width: max-content;
    animation: marqueeScroll 40s linear infinite;
}

.marquee-track:hover {
    animation-play-state: paused;
}

.marquee-item {
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    padding: 0 20px;
    letter-spacing: 0.3px;
    transition: color 0.2s;
    cursor: default;
}

.marquee-item:hover {
    color: var(--accent);
}

.marquee-sep {
    color: var(--border);
    font-size: 14px;
    font-weight: 400;
    user-select: none;
}

@keyframes marqueeScroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* =============================
   CASE STUDY PAGES
============================= */
.cs-hero {
    padding: 0 0 72px;
    border-bottom: 1px solid var(--border);
}

.back-link {
    display: inline-block;
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 32px;
    transition: color 0.2s;
}

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

.cs-tag {
    display: inline-block;
    padding: 4px 14px;
    background: rgba(37,99,235,0.08);
    color: var(--accent);
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
    border: 1px solid rgba(37,99,235,0.2);
}

.cs-hero h1 {
    font-size: 44px;
    font-weight: 800;
    letter-spacing: -1.5px;
    line-height: 1.1;
    margin-bottom: 20px;
    max-width: 700px;
}

.cs-summary {
    font-size: 18px;
    color: var(--muted);
    line-height: 1.75;
    max-width: 640px;
    margin-bottom: 30px;
}

.cs-meta {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
}

.cs-meta span {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
}

.cs-meta strong {
    color: var(--text);
}

/* Case Study Content Layout */
.cs-content {
    padding: 80px 0;
}

.cs-layout {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 64px;
    align-items: start;
}

.cs-main .cs-section {
    margin-bottom: 52px;
}

.cs-main .cs-section:last-child {
    margin-bottom: 0;
}

.cs-section h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
    margin-bottom: 16px;
    color: var(--text);
}

.cs-section p {
    font-size: 16px;
    color: var(--muted);
    line-height: 1.85;
    margin-bottom: 14px;
}

.cs-section p:last-child {
    margin-bottom: 0;
}

.cs-section ul {
    list-style: none;
    padding: 0;
}

.cs-section ul li {
    font-size: 15px;
    color: var(--muted);
    line-height: 1.7;
    padding: 10px 0 10px 22px;
    position: relative;
    border-bottom: 1px solid var(--border);
}

.cs-section ul li:first-child {
    border-top: 1px solid var(--border);
}

.cs-section ul li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: 700;
}

/* Case Study Sidebar */
.cs-sidebar {
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-card {
    padding: 22px;
    background: var(--card);
    border-radius: 16px;
    border: 1px solid var(--border);
}

.sidebar-card h4 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--muted);
    margin-bottom: 14px;
}

.outcome-stat {
    font-size: 48px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -2px;
    line-height: 1;
    margin-bottom: 8px;
}

.outcome-label {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.5;
}

/* Case study back button at bottom */
.cs-back {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

/* =============================
   RESPONSIVE
============================= */
@media (max-width: 960px) {
    .about-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .about-stats {
        grid-template-columns: repeat(4, 1fr);
    }

    .cs-layout {
        grid-template-columns: 1fr;
    }

    .cs-sidebar {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar-card {
        flex: 1;
        min-width: 180px;
    }
}

@media (max-width: 900px) {
    nav { display: none; }
    .menu-toggle { display: flex; }
}

@media (max-width: 768px) {
    .hero {
        padding: 100px 0 80px;
    }

    .hero h1 {
        font-size: 38px;
        letter-spacing: -1px;
    }

    .hero p {
        font-size: 16px;
    }

    .section {
        padding: 80px 0;
    }

    .section-title {
        font-size: 28px;
    }

    .about-stats {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .cs-hero h1 {
        font-size: 30px;
    }

    .cs-summary {
        font-size: 16px;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .footer-links {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 30px;
        letter-spacing: -0.5px;
    }

    .hero-actions {
        flex-direction: column;
        align-items: center;
    }

    .contact-actions {
        flex-direction: column;
        align-items: center;
    }

    .cs-meta {
        flex-direction: column;
        gap: 10px;
    }

    .about-stats {
        grid-template-columns: 1fr 1fr;
    }
}