/* ====================================
   Reset & Base Styles
   ==================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ====================================
   CSS Variables - Light Theme
   ==================================== */
:root {
    --bg: #FAFAF9;
    --text: #1A1A1A;
    --text-muted: #6B6B6B;
    --accent: #2D2D2D;
    --border: #E5E5E5;
    --card-bg: #FFFFFF;
    --tag-bg: #F0F0F0;
    --code-bg: #1E1E1E;
    --highlight-red: #FF6B6B;
    --highlight-green: #4ECB71;
    --highlight-yellow: #FFD93D;
}

/* ====================================
   CSS Variables - Dark Theme
   ==================================== */
[data-theme="dark"] {
    --bg: #0F0F0F;
    --text: #E5E5E5;
    --text-muted: #A0A0A0;
    --accent: #E5E5E5;
    --border: #2A2A2A;
    --card-bg: #1A1A1A;
    --tag-bg: #252525;
    --code-bg: #1E1E1E;
    --highlight-red: #FF8A8A;
    --highlight-green: #6FE091;
    --highlight-yellow: #FFE066;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

/* ====================================
   Navigation
   ==================================== */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(250, 250, 249, 0.9);
    backdrop-filter: blur(10px);
    z-index: 100;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

[data-theme="dark"] nav {
    background: rgba(15, 15, 15, 0.9);
}

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

.logo {
    font-family: 'Instrument Serif', serif;
    font-size: 1.5rem;
    text-decoration: none;
    color: var(--text);
    letter-spacing: -0.02em;
}

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

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 400;
    transition: color 0.2s ease;
    position: relative;
}

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

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

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

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

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

.back-link svg {
    width: 16px;
    height: 16px;
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.theme-toggle:hover {
    background: var(--tag-bg);
    transform: scale(1.05);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    color: var(--text);
    transition: all 0.3s ease;
}

.theme-toggle .sun-icon {
    position: absolute;
    opacity: 1;
}

.theme-toggle .moon-icon {
    position: absolute;
    opacity: 0;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    opacity: 0;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    opacity: 1;
}

.nav-resume-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: #fff !important;
    border-radius: 5px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.25s ease;
}

[data-theme="dark"] .nav-resume-btn {
    background: var(--accent);
    color: #000 !important;
}

.nav-resume-btn::after {
    display: none !important;
}

.nav-resume-btn:hover {
    background: #000;
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .nav-resume-btn:hover {
    background: #fff;
    color: #000 !important;
}

.nav-resume-btn svg {
    width: 14px;
    height: 14px;
}

/* ====================================
   Scroll to Top Button
   ==================================== */
.scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 90;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .scroll-to-top {
    background: var(--accent);
    color: #000;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.scroll-to-top svg {
    width: 24px;
    height: 24px;
}

.scroll-to-top::before {
    content: 'Back to top';
    position: absolute;
    right: 60px;
    background: var(--card-bg);
    color: var(--text);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.scroll-to-top:hover::before {
    opacity: 1;
    visibility: visible;
    right: 65px;
}

/* ====================================
   Mobile Menu
   ==================================== */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 110;
}

.mobile-menu-btn span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text);
    transition: all 0.3s ease;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.mobile-nav {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: rgba(250, 250, 249, 0.98);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 2rem;
    transform: translateY(-100%);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 99;
}

[data-theme="dark"] .mobile-nav {
    background: rgba(15, 15, 15, 0.98);
}

.mobile-nav.active {
    transform: translateY(0);
    opacity: 1;
}

.mobile-nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.mobile-nav-links li {
    border-bottom: 1px solid var(--border);
}

.mobile-nav-links li:last-child {
    border-bottom: none;
}

.mobile-nav-links a {
    display: block;
    padding: 1rem 0;
    text-decoration: none;
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 400;
}

.mobile-theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0;
    cursor: pointer;
}

.mobile-theme-toggle svg {
    width: 20px;
    height: 20px;
    color: var(--text);
}

.mobile-nav-links .mobile-resume-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.75rem 1.25rem;
    background: var(--accent);
    color: #fff;
    border-radius: 6px;
    font-weight: 500;
}

[data-theme="dark"] .mobile-nav-links .mobile-resume-btn {
    color: #000;
}

.mobile-nav-links .mobile-resume-btn svg {
    width: 16px;
    height: 16px;
}

/* ====================================
   Buttons
   ==================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 1.8rem;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.25s ease;
}

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

[data-theme="dark"] .btn-primary {
    color: #000;
}

.btn-primary:hover {
    background: #000;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .btn-primary:hover {
    background: #fff;
    color: #000;
}

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

.btn-secondary:hover {
    border-color: var(--text);
    transform: translateY(-2px);
}

.btn svg {
    width: 16px;
    height: 16px;
}

/* ====================================
   Section Styles
   ==================================== */
section {
    padding: 8rem 0;
}

.section-header {
    margin-bottom: 4rem;
}

.section-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.section-title {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 400;
    letter-spacing: -0.02em;
}

/* ====================================
   Tags
   ==================================== */
.tag {
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
    background: var(--tag-bg);
    border-radius: 50px;
    color: var(--text-muted);
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.skill-tag {
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 50px;
    color: var(--text);
    font-weight: 400;
    transition: all 0.3s ease;
}

/* ====================================
   Animations
   ==================================== */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-on-scroll {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ====================================
   Responsive Design
   ==================================== */
@media (max-width: 600px) {
    .nav-links {
        display: none;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .mobile-nav {
        display: block;
    }

    section {
        padding: 5rem 0;
    }

    .scroll-to-top {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 45px;
        height: 45px;
    }

    .scroll-to-top::before {
        display: none;
    }
}
