:root {
    --bg: #ffffff;
    --text: #1a1a1a;
    --text-secondary: #555;
    --text-muted: #999;
    --border: #eee;
    --nav-hover-bg: #f0f0f0;
    --accent: #6366f1;
    --accent-bg: rgba(99, 102, 241, 0.08);
    --accent-border: rgba(99, 102, 241, 0.25);
    --code-bg: #f5f5f5;
    --pre-bg: #1e1e1e;
    --pre-text: #f5f5f5;
    --modal-bg: #ffffff;
    --input-bg: #ffffff;
    --input-border: #ddd;
    --submit-bg: #1a1a1a;
    --submit-bg-hover: #333;
    --bg-overlay: rgba(255, 255, 255, 0.75);
}

html[data-theme="dark"] {
    --bg: #121212;
    --text: #f1f1f1;
    --text-secondary: #b3b3b3;
    --text-muted: #777;
    --border: #2a2a2a;
    --nav-hover-bg: #1f1f1f;
    --accent: #818cf8;
    --accent-bg: rgba(129, 140, 248, 0.12);
    --accent-border: rgba(129, 140, 248, 0.3);
    --code-bg: #1f1f1f;
    --pre-bg: #1a1a1a;
    --pre-text: #f1f1f1;
    --modal-bg: #1c1c1c;
    --input-bg: #1a1a1a;
    --input-border: #333;
    --submit-bg: #818cf8;
    --submit-bg-hover: #6366f1;
    --bg-overlay: rgba(18, 18, 18, 0.75);
}

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

html {
    background: var(--bg);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.7;
    color: var(--text);
    position: relative;
    min-height: 100vh;
    transition: color 0.2s ease;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: linear-gradient(var(--bg-overlay), var(--bg-overlay)), url('/images/background.jpg');
    background-size: cover;
    background-position: center 25%;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 24px 80px;
}

/* Navigation */
.site-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 24px 0 28px;
    margin-bottom: 10px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    background: var(--modal-bg);
    border: 1px solid var(--border);
    border-radius: 50px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.02);
}

.nav-links a,
.nav-link-btn {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    font-family: inherit;
    background: none;
    border: none;
    padding: 7px 16px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.nav-links a:hover,
.nav-link-btn:hover {
    color: var(--text);
    background: var(--nav-hover-bg);
}

.nav-links a.active {
    background: var(--text);
    color: var(--bg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.nav-links a.active:hover {
    background: var(--text);
    color: var(--bg);
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    color: var(--text);
    background: var(--nav-hover-bg);
}

.theme-icon-dark {
    display: none;
}

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

html[data-theme="dark"] .theme-icon-dark {
    display: inline;
}

/* Intro / Header */
.intro {
    text-align: center;
    padding: 40px 0 30px;
}

.intro h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.intro .title {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.intro .location {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 700;
}

/* Summary */
.summary {
    margin-bottom: 30px;
}

.summary p {
    margin-bottom: 18px;
    color: var(--text-secondary);
    font-size: 1.02rem;
}

/* Skills */
.skills-section {
    margin-bottom: 40px;
}

.section-label {
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.skills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

/* Skills carousel */
.skills-carousel {
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to right, transparent, black 6%, black 94%, transparent);
    mask-image: linear-gradient(to right, transparent, black 6%, black 94%, transparent);
}

.skills-track {
    display: flex;
    gap: 36px;
    width: max-content;
    animation: skills-scroll 32s linear infinite;
}

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

.skill-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 64px;
}

.skill-item img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    opacity: 0.85;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.skill-item span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 700;
    white-space: nowrap;
}

.skill-item:hover img {
    opacity: 1;
    transform: translateY(-3px);
}

.skill-item:hover span {
    color: var(--text-secondary);
}

@keyframes skills-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

.skill-tag {
    display: inline-flex;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--modal-bg);
    backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 14px;
    transition: all 0.2s ease;
}

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

/* Certifications */
.certifications {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cert-item {
    white-space: nowrap;
}

.cert-item i {
    color: var(--accent);
    margin-right: 4px;
    opacity: 0.7;
}

.cert-sep {
    margin: 0 10px;
    opacity: 0.5;
}

/* Socials */
.socials {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.socials a {
    color: var(--text-secondary);
    font-size: 1.2rem;
    transition: color 0.2s ease;
}

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

/* Blog list */
.post-list {
    display: flex;
    flex-direction: column;
}

.post-item {
    display: block;
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
}

.post-item:last-child {
    border-bottom: none;
}

.post-item h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.project-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.project-title-row h2 {
    margin-bottom: 0;
}

.project-link {
    color: var(--text-muted);
    font-size: 1rem;
    text-decoration: none;
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.project-link:hover {
    color: var(--text);
}

.post-item .post-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.post-item p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Blog post body */
.post-body {
    font-size: 1.02rem;
    color: var(--text-secondary);
}

.post-body h2 {
    margin: 32px 0 14px;
    font-size: 1.4rem;
    color: var(--text);
}

.post-body h3 {
    margin: 24px 0 12px;
    font-size: 1.15rem;
    color: var(--text);
}

.post-body p {
    margin-bottom: 18px;
}

.post-body ul,
.post-body ol {
    margin-bottom: 18px;
    padding-left: 26px;
}

.post-body li {
    margin-bottom: 6px;
}

.post-body code {
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.post-body pre {
    background: var(--pre-bg);
    color: var(--pre-text);
    padding: 18px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 18px;
}

.post-body pre code {
    background: none;
    padding: 0;
}

.post-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 28px 0;
}

.post-body blockquote {
    border-left: 3px solid var(--border);
    padding-left: 16px;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 18px;
}

.back-link {
    margin-top: 30px;
}

.back-link a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
}

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

/* Footer */
.site-footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Contact Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--modal-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    padding: 32px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    animation: modalSlideIn 0.22s ease forwards;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
}

.modal-eyebrow {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 4px;
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
}

.close-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    background: var(--nav-hover-bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.18s ease;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    font-size: 0.92rem;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.form-group textarea {
    resize: vertical;
    min-height: 110px;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.submit-btn {
    background: var(--submit-bg);
    color: #fff;
    padding: 11px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 4px;
    position: relative;
    letter-spacing: 0.01em;
    transition: background 0.18s ease, transform 0.15s ease;
}

.submit-btn:hover:not(:disabled) {
    background: var(--submit-bg-hover);
    transform: translateY(-1px);
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.submit-btn:disabled {
    cursor: not-allowed;
    opacity: 0.75;
}

.submit-btn.loading {
    color: transparent;
}

.submit-btn.loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btn-spin 0.7s linear infinite;
}

@keyframes btn-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Success message */
.success-msg {
    display: none;
    text-align: center;
    padding: 8px 0;
    animation: fadeInUp 0.3s ease forwards;
}

.success-icon {
    width: 48px;
    height: 48px;
    background: var(--accent-bg);
    border: 1px solid var(--accent-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.2rem;
    color: var(--accent);
}

.success-msg h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.success-msg p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.success-close-btn {
    margin-top: 20px;
    background: var(--submit-bg);
    color: #fff;
    padding: 10px 28px;
    border: none;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.success-close-btn:hover {
    background: var(--submit-bg-hover);
}

/* Entrance animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container > * {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.container > *:nth-child(1) { animation-delay: 0.08s; }
.container > *:nth-child(2) { animation-delay: 0.16s; }
.container > *:nth-child(3) { animation-delay: 0.24s; }
.container > *:nth-child(4) { animation-delay: 0.32s; }

@media (prefers-reduced-motion: reduce) {
    .site-nav,
    .container > * {
        opacity: 1;
        animation: none;
    }

    .skills-track {
        animation: none;
    }
}

/* Responsive */
@media (max-width: 480px) {
    .intro h1 {
        font-size: 1.6rem;
    }
}
