:root {
    --bg: #ffffff;
    --surface: #f8fafc;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --input-bg: #ffffff;
    --header-bg: rgba(255, 255, 255, 0.85);
    --alert-success-bg: #ecfdf5;
    --alert-success-text: #065f46;
    --alert-success-border: #a7f3d0;
    --alert-error-bg: #fef2f2;
    --alert-error-text: #991b1b;
    --alert-error-border: #fecaca;
}

[data-theme="dark"] {
    --bg: #0b0f19;
    --surface: #151d30;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --border: #1e293b;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --input-bg: #151d30;
    --header-bg: rgba(11, 15, 25, 0.85);
    --alert-success-bg: #064e3b;
    --alert-success-text: #6ee7b7;
    --alert-success-border: #047857;
    --alert-error-bg: #7f1d1d;
    --alert-error-text: #fca5a5;
    --alert-error-border: #b91c1c;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    border-bottom: 1px solid var(--border);
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.nav-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-links a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.nav-links a:hover {
    color: var(--text);
}

/* Theme Toggle Button */
.theme-toggle {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
    padding: 0;
    flex-shrink: 0;
    outline: none;
}

.theme-toggle:hover {
    background: var(--border);
    transform: scale(1.05);
}

.theme-toggle svg {
    width: 19px;
    height: 19px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: block;
}

/* Light mode: show moon icon (to switch to dark), hide sun */
.sun-icon {
    display: none !important;
}
.moon-icon {
    display: block !important;
}

/* Dark mode: show sun icon (to switch to light), hide moon */
[data-theme="dark"] .sun-icon {
    display: block !important;
}
[data-theme="dark"] .moon-icon {
    display: none !important;
}

/* Hero */
.hero {
    padding: 72px 0 48px;
}

.role {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.hero h1 {
    font-size: 2.25rem;
    line-height: 1.2;
    margin-bottom: 14px;
}

.tagline {
    color: var(--muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin-bottom: 24px;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

/* Sections & Anchor Scroll Offset */
.section {
    padding: 44px 0;
    border-top: 1px solid var(--border);
    scroll-margin-top: 90px;
    transition: border-color 0.3s ease;
}

.section h2 {
    font-size: 1.4rem;
    margin-bottom: 16px;
}

/* About & Skills */
.about-text {
    color: var(--muted);
    margin-bottom: 18px;
}

.skills-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.skills-list li {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Projects */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.project-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

.project-card:hover {
    border-color: var(--accent);
}

.project-card h3 {
    font-size: 1.05rem;
    margin-bottom: 8px;
}

.project-card p {
    color: var(--muted);
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.project-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.tech {
    color: var(--muted);
}

.project-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.project-footer a:hover {
    text-decoration: underline;
}

/* Contact */
.contact-intro {
    color: var(--muted);
    margin-bottom: 20px;
}

.contact-intro a {
    color: var(--accent);
    text-decoration: none;
}

.contact-form {
    max-width: 520px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font: inherit;
    font-size: 0.95rem;
    background: var(--input-bg);
    color: var(--text);
    transition: border-color 0.2s ease, background-color 0.3s ease, color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.alert {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    max-width: 520px;
    font-size: 0.95rem;
}

.alert-success {
    background: var(--alert-success-bg);
    color: var(--alert-success-text);
    border: 1px solid var(--alert-success-border);
}

.alert-error {
    background: var(--alert-error-bg);
    color: var(--alert-error-text);
    border: 1px solid var(--alert-error-border);
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    margin-top: 24px;
    color: var(--muted);
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.social-links {
    display: flex;
    gap: 16px;
}

.social-links a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.social-links a:hover {
    color: var(--text);
}

/* Responsive */
@media (max-width: 600px) {
    .hero h1 {
        font-size: 1.8rem;
    }

    .hero {
        padding: 48px 0 32px;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .footer-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .nav-links {
        gap: 12px;
    }

    .nav-links a {
        font-size: 0.88rem;
    }

    .nav-right {
        gap: 12px;
    }

    .theme-toggle {
        width: 34px;
        height: 34px;
    }
}
