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

html {
    scroll-behavior: smooth;
}

/* ============================================
   Theme tokens — Neutral / Terminal / Glass
   ============================================ */

:root {
    --container-width: 1200px;
    --radius-pill: 999px;
    /* Real height set by script.js; this is just a sane fallback. */
    --navbar-h: 68px;
}

[data-theme="terminal"] {
    --bg: #0a0e0f;
    --bg-soft: #0d1213;
    --bg-elevated: #101516;
    --text: #e6f1ee;
    --text-muted: #8a9a98;
    --text-faint: #4a5c59;
    --accent: #4ade80;
    --accent-2: #7db3ff;
    --accent-contrast: #06240f;
    --border: #1f2b2e;
    --border-strong: #2a3a38;
    --radius-sm: 6px;
    --radius-lg: 12px;
    --font-display: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
    --font-body: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
    --shadow-card: 0 4px 15px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.5);
}

[data-theme="glass"] {
    --bg: #150f2e;
    --bg-soft: #1c1440;
    --bg-elevated: rgba(255, 255, 255, 0.09);
    --text: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.72);
    --text-faint: rgba(255, 255, 255, 0.5);
    --accent: #f0abfc;
    --accent-2: #93c5fd;
    --accent-contrast: #1a0b2e;
    --border: rgba(255, 255, 255, 0.22);
    --border-strong: rgba(255, 255, 255, 0.32);
    --radius-sm: 10px;
    --radius-lg: 20px;
    --font-display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
    --font-body: 'Manrope', ui-sans-serif, system-ui, sans-serif;
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.5);
}

[data-theme="neutral"] {
    --bg: #fafafa;
    --bg-soft: #f0f0f0;
    --bg-elevated: #ffffff;
    --text: #141414;
    --text-muted: #5c5c5c;
    --text-faint: #8f8f8f;
    --accent: #141414;
    --accent-2: #5c5c5c;
    --accent-contrast: #ffffff;
    --border: #e2e2e2;
    --border-strong: #cfcfcf;
    --radius-sm: 10px;
    --radius-lg: 18px;
    --font-display: 'Sora', ui-sans-serif, system-ui, sans-serif;
    --font-body: 'Karla', ui-sans-serif, system-ui, sans-serif;
    --shadow-card: 0 4px 15px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.12);
}

/* ============================================
   Base
   ============================================ */

body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

a {
    color: var(--accent);
}

h1, h2, h3 {
    font-family: var(--font-display);
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--accent);
    color: var(--accent-contrast);
    padding: 10px 18px;
    z-index: 2000;
    border-radius: 0 0 8px 0;
    font-weight: 700;
    text-decoration: none;
}

.skip-link:focus {
    left: 0;
}

/* ============================================
   Navigation
   ============================================ */

.navbar {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

[data-theme="glass"] .navbar {
    background: rgba(21, 15, 46, 0.75);
    backdrop-filter: blur(16px);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 16px 24px;
    flex-wrap: wrap;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--accent-contrast);
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 12px;
    flex-shrink: 0;
}

.brand-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
}

.nav-menu-inline {
    display: flex;
    gap: 26px;
    list-style: none;
    font-size: 14px;
}

/* The drawer (#navMenu) is a top-level sibling of .navbar, not nested inside
   it — that keeps its stacking context independent of the navbar's, so it
   can never paint over navbar controls like the hamburger. Hidden here;
   the mobile media query turns it into the slide-in panel. */
.nav-menu {
    display: none;
    list-style: none;
}

.nav-menu-inline a,
.nav-menu a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-menu-inline a:hover,
.nav-menu a:hover {
    color: var(--accent);
}

.theme-switch {
    display: flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--bg-soft);
}

.theme-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-body);
    transition: all 0.2s ease;
}

.theme-btn:hover {
    color: var(--text);
}

.theme-btn[aria-pressed="true"] {
    background: var(--accent);
    color: var(--accent-contrast);
}

.nav-theme-switch-wrap {
    display: none;
}

.nav-overlay {
    display: none;
}

.nav-close-wrap {
    display: none;
}

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

.hamburger span {
    width: 24px;
    height: 2px;
    background: var(--text);
    transition: 0.3s;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    padding: 13px 26px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    font-family: var(--font-body);
    transition: all 0.2s ease;
    border: 1.5px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
    filter: brightness(1.05);
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--border-strong);
}

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

/* ============================================
   Sections (shared)
   ============================================ */

section {
    padding: 88px 0;
}

.section-head {
    margin-bottom: 44px;
}

.section-head h2 {
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}

.eyebrow {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 12px;
    font-weight: 600;
}

[data-theme="terminal"] .eyebrow {
    text-transform: none;
    letter-spacing: 0;
    font-size: 13px;
}

/* ============================================
   Hero
   ============================================ */

.hero {
    position: relative;
    overflow: hidden;
    padding: 100px 0 80px;
}

.mesh-bg {
    position: absolute;
    inset: 0;
    display: none;
    pointer-events: none;
}

[data-theme="glass"] .mesh-bg {
    display: block;
    background:
        radial-gradient(600px 600px at 8% 8%, rgba(124, 58, 237, 0.45), transparent 60%),
        radial-gradient(650px 650px at 92% 12%, rgba(236, 72, 153, 0.35), transparent 60%),
        radial-gradient(700px 700px at 30% 85%, rgba(59, 130, 246, 0.3), transparent 60%),
        radial-gradient(550px 550px at 88% 90%, rgba(6, 182, 212, 0.3), transparent 60%);
    filter: blur(20px);
}

.hero-inner {
    display: flex;
    align-items: center;
    gap: 56px;
    position: relative;
    z-index: 1;
}

.hero-content {
    flex: 1;
    min-width: 0;
}

.window-chrome {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    width: fit-content;
    margin-bottom: 24px;
}

[data-theme="terminal"] .window-chrome {
    display: flex;
}

.chrome-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot-red { background: #f87171; }
.dot-yellow { background: #fbbf24; }
.dot-green { background: #4ade80; }

.chrome-title {
    font-size: 11px;
    color: var(--text-faint);
    margin-left: 6px;
}

h1 {
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.02em;
    margin-bottom: 20px;
    color: var(--text);
}

.hero-tagline {
    font-size: 17px;
    line-height: 1.75;
    color: var(--text-muted);
    max-width: 560px;
    margin-bottom: 32px;
}

.hero-buttons {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.hero-photo {
    width: 240px;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    position: relative;
}

.photo-frame {
    position: relative;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    z-index: 1;
}

[data-theme="terminal"] .photo-frame {
    border: 2px dashed var(--border-strong);
    background: var(--bg-soft);
}

[data-theme="glass"] .photo-frame {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
    box-shadow: 0 0 0 6px rgba(240, 171, 252, 0.15);
}

[data-theme="neutral"] .photo-frame {
    border: 3px solid #ffffff;
    background: var(--bg-elevated);
    box-shadow: var(--shadow-lg);
}

.hero-photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* ============================================
   About
   ============================================ */

.about-section {
    background: var(--bg-soft);
}

.about-body p {
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1.8;
    max-width: 760px;
    margin-bottom: 18px;
}

.about-body strong {
    color: var(--text);
}

.about-facts {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 28px;
}

.fact {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    color: var(--text);
}

.fact i {
    color: var(--accent);
}

/* ============================================
   Services
   ============================================ */

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    gap: 20px;
}

.service-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: all 0.2s ease;
}

[data-theme="glass"] .service-card {
    backdrop-filter: blur(20px);
}

.service-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow-card);
}

.service-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.service-icon i {
    color: var(--accent);
    font-size: 19px;
}

.service-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.service-card p {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.6;
}

/* ============================================
   Featured Projects
   ============================================ */

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: 22px;
}

.featured-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: all 0.25s ease;
}

[data-theme="glass"] .featured-card {
    backdrop-filter: blur(20px);
}

.featured-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: var(--shadow-card);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    gap: 12px;
}

.card-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
}

.badge {
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge.python { background: #3776ab; color: #fff; }
.badge.javascript { background: #f7df1e; color: #1a1a1a; }
.badge.typescript { background: #3178c6; color: #fff; }
.badge.dart { background: #0175c2; color: #fff; }

.featured-card p {
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    font-size: 0.92rem;
    line-height: 1.65;
}

.card-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.tag {
    background: var(--bg-soft);
    color: var(--text-muted);
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    border: 1px solid var(--border);
}

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

.card-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: gap 0.2s ease;
}

.card-link:hover {
    gap: 10px;
}

.card-link-secondary {
    color: var(--text-muted);
}

.card-link-secondary:hover {
    color: var(--accent-2);
}

/* ============================================
   Skills
   ============================================ */

.skills-section {
    background: var(--bg-soft);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
}

.skill-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 18px 20px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    transition: all 0.2s ease;
}

.skill-chip:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.skill-chip i {
    font-size: 20px;
    color: var(--accent);
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

/* ============================================
   Contact
   ============================================ */

.contact-section {
    text-align: center;
}

.contact-section .section-head {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.contact-lead {
    color: var(--text-muted);
    font-size: 16px;
    max-width: 520px;
    margin: 0 auto 40px;
}

.contact-links {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 26px;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border-strong);
    color: var(--text);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

.contact-btn i {
    color: var(--accent);
}

.contact-btn:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}

.contact-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 560px;
    margin: 52px auto;
    color: var(--text-faint);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.contact-divider::before,
.contact-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.project-form-card {
    max-width: 560px;
    margin: 0 auto;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px;
    text-align: left;
}

[data-theme="glass"] .project-form-card {
    backdrop-filter: blur(20px);
}

.project-form-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.project-form-lead {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.form-row {
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-row label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-row input,
.form-row textarea {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text);
    background: var(--bg-soft);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.form-row input:focus,
.form-row textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-honey {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.form-submit {
    width: 100%;
    justify-content: center;
    border: none;
}

.form-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.form-status {
    margin-top: 14px;
    font-size: 13px;
    color: var(--accent);
    min-height: 18px;
}

.form-status-error {
    color: #f87171;
}

/* ============================================
   Footer
   ============================================ */

.footer {
    background: var(--bg-soft);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    text-align: center;
    padding: 36px 0;
    font-size: 13px;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.footer-social {
    display: flex;
    gap: 18px;
}

.footer-social a {
    color: var(--text-muted);
    font-size: 18px;
    transition: color 0.2s ease;
}

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

.footer-top {
    color: var(--text-faint);
    text-decoration: none;
    font-size: 12px;
    transition: color 0.2s ease;
}

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

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 900px) {
    .nav-menu {
        display: flex;
        position: fixed;
        top: var(--navbar-h, 68px);
        right: 0;
        height: auto;
        max-height: calc(100vh - var(--navbar-h, 68px));
        width: min(70vw, 340px);
        flex-direction: column;
        background: var(--bg);
        border-left: 1px solid var(--border);
        border-radius: 16px 0 0 16px;
        padding: 20px 28px 28px;
        gap: 8px;
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        z-index: 999;
        box-shadow: -16px 0 40px rgba(0, 0, 0, 0.3);
    }

    .nav-menu a {
        display: block;
        padding: 10px 0;
        font-size: 16px;
    }

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

    .nav-close-wrap {
        display: block;
        position: absolute;
        top: 14px;
        right: 14px;
    }

    .nav-close {
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        background: var(--bg-soft);
        color: var(--text-muted);
        font-size: 15px;
        cursor: pointer;
        transition: all 0.2s ease;
    }

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

    .nav-overlay {
        display: block;
        position: fixed;
        top: var(--navbar-h, 68px);
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.55);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 998;
    }

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

    .nav-menu-inline {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    /* The drawer's own close button sits in the same corner as the hamburger
       once open, so hide the hamburger to avoid two overlapping tap targets. */
    .hamburger[aria-expanded="true"] {
        visibility: hidden;
    }

    .theme-switch-desktop {
        display: none;
    }

    .nav-theme-switch-wrap {
        display: block;
        margin-top: 8px;
    }

    .nav-theme-switch-wrap .theme-switch {
        justify-content: center;
        flex-wrap: wrap;
        row-gap: 6px;
    }

    .nav-theme-switch-wrap .theme-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .hero-inner {
        flex-direction: column-reverse;
        text-align: center;
        gap: 36px;
    }

    .hero-tagline {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-buttons {
        justify-content: center;
    }

    .window-chrome {
        margin-left: auto;
        margin-right: auto;
    }

    section {
        padding: 64px 0;
    }
}

@media (max-width: 560px) {
    .nav-inner {
        padding: 14px 20px;
    }

    .brand-name {
        display: none;
    }

    .hero {
        padding: 64px 0 48px;
    }

    .hero-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .contact-links {
        flex-direction: column;
        align-items: stretch;
    }

    .project-form-card {
        padding: 24px;
    }
}
