:root {
    --primary-color: #c9a46a;
    --secondary-color: #7c8f78;
    --accent-color: #9b6f4f;
    --bg-dark: #f5f1e8;
    --bg-darker: #ebe4d6;
    --text-primary: #211f1a;
    --text-secondary: #686259;
    --text-accent: #8f693f;
    --card-bg: rgba(255, 252, 246, 0.82);
    --border-color: rgba(58, 49, 38, 0.14);
    --glow-color: rgba(201, 164, 106, 0.18);
    --surface: rgba(255, 252, 246, 0.9);
    --surface-strong: #fffaf0;
    --ink-muted: #8a8175;
    --shadow-soft: 0 18px 60px rgba(45, 38, 28, 0.1);
    --shadow-lift: 0 24px 70px rgba(45, 38, 28, 0.14);
    --cursor-x: 50vw;
    --cursor-y: 50vh;
    --mag-x: 0px;
    --mag-y: 0px;
    --tilt-x: 0deg;
    --tilt-y: 0deg;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Inter", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif !important;
    background:
        linear-gradient(180deg, rgba(255, 252, 246, 0.94), rgba(245, 241, 232, 0.98)),
        radial-gradient(circle at 18% 0%, rgba(201, 164, 106, 0.14), transparent 28%),
        radial-gradient(circle at 86% 14%, rgba(124, 143, 120, 0.13), transparent 30%) !important;
    color: var(--text-primary) !important;
    letter-spacing: 0 !important;
    isolation: isolate;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -2;
    opacity: 0.42;
    background-image:
        linear-gradient(rgba(35, 31, 25, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(35, 31, 25, 0.035) 1px, transparent 1px);
    background-size: 44px 44px;
    animation: elegantGridDrift 18s linear infinite;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    background:
        radial-gradient(
            520px circle at var(--cursor-x) var(--cursor-y),
            rgba(201, 164, 106, 0.22),
            rgba(124, 143, 120, 0.08) 34%,
            transparent 68%
        );
    transition: opacity 0.4s ease;
}

body.has-pointer::after {
    opacity: 1;
}

@keyframes elegantGridDrift {
    from {
        background-position: 0 0, 0 0;
    }

    to {
        background-position: 44px 44px, 44px 44px;
    }
}

::selection {
    background: rgba(201, 164, 106, 0.28);
    color: #171511;
}

.loading,
.bg-animation,
.code-rain,
.hero-particles,
.loading-particles,
.scroll-indicator,
.cursor,
.btn-shine {
    display: none !important;
}

.navbar {
    background: rgba(255, 250, 240, 0.82) !important;
    border-bottom: 1px solid var(--border-color) !important;
    box-shadow: 0 12px 36px rgba(45, 38, 28, 0.06) !important;
}

.nav-container,
.projects-container,
.skills-container,
.contact-container,
.footer-content {
    max-width: 1160px !important;
}

.logo,
.back-link {
    color: var(--text-primary) !important;
    font-family: "Inter", sans-serif !important;
    font-weight: 700 !important;
}

.logo i,
.back-link i {
    color: var(--primary-color) !important;
    animation: none !important;
}

.nav-links a {
    color: var(--text-secondary) !important;
    border-radius: 999px !important;
}

.nav-links a:hover,
.nav-links a:focus-visible {
    color: var(--text-primary) !important;
    background: rgba(201, 164, 106, 0.14) !important;
}

.nav-links a::after,
.project-header::before,
.about-card::before {
    display: none !important;
}

.main-container {
    margin-top: 72px !important;
}

.hero {
    min-height: calc(100vh - 72px) !important;
    height: auto !important;
    padding: 7rem 1.5rem 5rem !important;
    text-align: left !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    overflow: hidden !important;
}

.hero-content {
    width: min(1120px, 100%) !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.72fr) !important;
    gap: 3rem !important;
    align-items: center !important;
    padding: 0 !important;
    position: relative !important;
    z-index: 2 !important;
}

.motion-field {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    opacity: 0.52;
    pointer-events: none;
    mix-blend-mode: multiply;
}

.terminal-window {
    grid-column: 2 !important;
    grid-row: 1 / span 5 !important;
    margin: 0 !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    background: rgba(33, 31, 26, 0.92) !important;
    box-shadow: var(--shadow-soft) !important;
    animation: terminalBreathe 5.5s ease-in-out infinite !important;
}

@keyframes terminalBreathe {
    0%,
    100% {
        box-shadow: 0 18px 60px rgba(45, 38, 28, 0.1);
        transform: translate3d(0, 0, 0);
    }

    50% {
        box-shadow: 0 26px 90px rgba(45, 38, 28, 0.17);
        transform: translate3d(0, -6px, 0);
    }
}

.terminal-header {
    background: rgba(255, 250, 240, 0.08) !important;
    border-bottom: 1px solid rgba(255, 250, 240, 0.12) !important;
}

.terminal-title,
.prompt,
.command,
.output-line {
    color: rgba(255, 250, 240, 0.74) !important;
}

.output-line.success,
.terminal-body .command {
    color: #e7c586 !important;
}

.hero-title,
.page-title,
.article-title,
.project-title,
.section-title,
.experience-title {
    color: var(--text-primary) !important;
    background: none !important;
    -webkit-text-fill-color: currentColor !important;
    text-shadow: none !important;
    animation: none !important;
    letter-spacing: 0 !important;
}

.hero-title {
    font-size: clamp(3.2rem, 7vw, 6.8rem) !important;
    line-height: 0.95 !important;
    max-width: 760px !important;
    margin: 0 0 1.4rem !important;
    perspective: 900px;
}

.hero-title .glitch,
.article-title,
.project-title,
.page-title {
    display: inline-block;
    animation: headlineLift 900ms cubic-bezier(0.19, 1, 0.22, 1) both !important;
}

@keyframes headlineLift {
    from {
        opacity: 0;
        transform: translate3d(0, 46px, 0) rotateX(18deg);
        clip-path: inset(0 0 100% 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) rotateX(0deg);
        clip-path: inset(0 0 0 0);
    }
}

.glitch::before,
.glitch::after {
    display: none !important;
}

.hero-subtitle {
    max-width: 650px !important;
    min-height: 0 !important;
    margin: 0 0 2rem !important;
    color: var(--text-secondary) !important;
    font-size: clamp(1.05rem, 2vw, 1.35rem) !important;
    line-height: 1.75 !important;
}

.hero-stats {
    grid-column: 1 !important;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(100px, 1fr)) !important;
    gap: 0.75rem !important;
    max-width: 680px !important;
    margin: 1rem 0 2.2rem !important;
}

.stat-item,
.about-card,
.project-card,
.skill-item,
.blog-card,
.skill-category,
.skill-card,
.experience-section,
.content-section,
.screenshot,
.project-header,
.modal-content,
.quote,
.bug-example,
.highlight-box,
.lesson-card,
.stats-section,
.future-plans,
.timeline-content {
    background: var(--surface) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    box-shadow: var(--shadow-soft) !important;
    backdrop-filter: blur(16px) !important;
}

.stat-item {
    padding: 1rem !important;
}

.stat-number,
.card-icon,
.skill-icon,
.blog-image i,
.article-icon,
.category-title,
.section-title i,
.feature-icon,
.meta-icon,
.read-more,
.article-content h2,
.article-content h3,
.timeline-year {
    color: var(--text-accent) !important;
    background: none !important;
    -webkit-text-fill-color: currentColor !important;
}

.stat-label,
.card-description,
.project-description,
.skill-level,
.blog-meta,
.blog-excerpt,
.project-subtitle,
.meta-item,
.article-meta,
.article-content p,
.article-content li,
.skill-description,
.feature-content p,
.contact p {
    color: var(--text-secondary) !important;
}

.cta-buttons,
.project-links,
.social-links,
.projects-filter {
    gap: 0.75rem !important;
}

.btn,
.filter-btn,
.project-link,
.social-link,
.read-more {
    border-radius: 999px !important;
    will-change: transform;
    transition: transform 0.22s ease, background 0.22s ease, border-color 0.22s ease, color 0.22s ease, box-shadow 0.22s ease !important;
}

.btn,
.project-link {
    border: 1px solid rgba(33, 31, 26, 0.16) !important;
    box-shadow: none !important;
}

.btn-primary,
.project-link:first-child,
.skill-level {
    background: #211f1a !important;
    color: #fffaf0 !important;
}

.btn-secondary,
.btn-tertiary,
.filter-btn,
.project-link,
.social-link {
    background: rgba(255, 250, 240, 0.74) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
}

.btn:hover,
.filter-btn:hover,
.filter-btn.active,
.project-link:hover,
.social-link:hover,
.read-more:hover {
    transform: translateY(-2px) !important;
    background: rgba(201, 164, 106, 0.16) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 14px 32px rgba(45, 38, 28, 0.1) !important;
}

.section-title {
    font-size: clamp(2rem, 4vw, 3.4rem) !important;
    line-height: 1.05 !important;
    margin-bottom: 2.25rem !important;
}

.content-section .section-title,
.experience-section .experience-title {
    font-size: 1.45rem !important;
    line-height: 1.25 !important;
    margin-bottom: 1rem !important;
}

.about,
.projects,
.skills,
.blog,
.contact {
    padding: 6rem 2rem !important;
    background: transparent !important;
}

.about-grid,
.projects-grid,
.skills-grid,
.blog-grid {
    gap: 1.25rem !important;
}

.about-card,
.project-card,
.skill-item,
.blog-card,
.skill-card {
    overflow: hidden !important;
    transform-style: preserve-3d;
    will-change: transform;
}

.about-card:hover,
.project-card:hover,
.skill-item:hover,
.blog-card:hover,
.skill-card:hover,
.skill-category:hover,
.content-section:hover {
    transform: translateY(-4px) !important;
    border-color: rgba(201, 164, 106, 0.42) !important;
    box-shadow: var(--shadow-lift) !important;
}

.project-image,
.blog-image,
.screenshot-placeholder {
    background:
        linear-gradient(135deg, rgba(33, 31, 26, 0.92), rgba(112, 94, 68, 0.88)),
        linear-gradient(45deg, var(--primary-color), var(--secondary-color)) !important;
    color: #fffaf0 !important;
}

.project-overlay {
    background: rgba(33, 31, 26, 0.72) !important;
}

.tech-tag,
.skill-tag,
.tag {
    background: rgba(201, 164, 106, 0.16) !important;
    border: 1px solid rgba(201, 164, 106, 0.28) !important;
    color: var(--text-accent) !important;
    border-radius: 999px !important;
}

.progress-bar {
    background: rgba(33, 31, 26, 0.08) !important;
}

.progress-fill,
.timeline::before,
.timeline-line {
    background: linear-gradient(90deg, #c9a46a, #7c8f78) !important;
}

.article-header,
.page-header {
    text-align: left !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.article-title,
.project-title,
.page-title {
    font-size: clamp(2.25rem, 5vw, 4.8rem) !important;
    line-height: 1.04 !important;
}

.container {
    padding-top: 2.5rem !important;
}

.article-content,
.article-content p,
.article-content li {
    font-size: 1.06rem !important;
}

.article-content h2 {
    border-bottom-color: rgba(201, 164, 106, 0.36) !important;
}

.article-content code,
.code-block,
.article-content pre {
    background: rgba(33, 31, 26, 0.92) !important;
    color: #f8efe0 !important;
    border-color: rgba(33, 31, 26, 0.18) !important;
    border-radius: 8px !important;
}

.article-content code,
.code-block code,
.article-content pre code {
    color: #e7c586 !important;
}

.quote,
blockquote,
.bug-example,
.highlight-box {
    border-left: 3px solid var(--primary-color) !important;
}

.highlight {
    color: var(--text-accent) !important;
    background: none !important;
    -webkit-text-fill-color: currentColor !important;
}

.project-content {
    align-items: start !important;
}

.content-section,
.feature-item {
    opacity: 1 !important;
}

.content-section,
.feature-item {
    transform: none !important;
}

.feature-item {
    background: rgba(255, 250, 240, 0.6) !important;
    border: 1px solid rgba(58, 49, 38, 0.08) !important;
    border-radius: 8px !important;
}

.feature-item:hover {
    background: rgba(201, 164, 106, 0.12) !important;
    transform: translateX(4px) !important;
}

.footer {
    background: rgba(33, 31, 26, 0.94) !important;
    color: rgba(255, 250, 240, 0.72) !important;
}

body.motion-ready .motion-reveal {
    opacity: 0 !important;
    transform: translate3d(0, 34px, 0) scale(0.985) !important;
    transition:
        opacity 0.85s cubic-bezier(0.19, 1, 0.22, 1),
        transform 0.85s cubic-bezier(0.19, 1, 0.22, 1),
        border-color 0.22s ease,
        box-shadow 0.22s ease,
        background 0.22s ease !important;
    transition-delay: var(--reveal-delay, 0ms) !important;
}

body.motion-ready .motion-reveal.is-visible {
    opacity: 1 !important;
    transform: translate3d(0, 0, 0) scale(1) !important;
}

body.has-pointer .tilt-ready.is-tilting {
    transform:
        perspective(900px)
        rotateX(var(--tilt-x))
        rotateY(var(--tilt-y))
        translate3d(0, -6px, 0) !important;
    box-shadow: var(--shadow-lift) !important;
}

body.has-pointer .magnetic.is-magnetic {
    transform: translate3d(var(--mag-x), var(--mag-y), 0) !important;
}

@media (prefers-reduced-motion: reduce) {
    body::before,
    .terminal-window,
    .hero-title .glitch,
    .article-title,
    .project-title,
    .page-title {
        animation: none !important;
    }

    body::after,
    .motion-field {
        display: none !important;
    }

    body.motion-ready .motion-reveal,
    body.motion-ready .motion-reveal.is-visible,
    body.has-pointer .tilt-ready.is-tilting,
    body.has-pointer .magnetic.is-magnetic {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

@media (max-width: 900px) {
    .hero-content {
        display: flex !important;
        flex-direction: column !important;
        gap: 1.5rem !important;
    }

    .terminal-window {
        margin: 2.5rem 0 0 !important;
        order: 5 !important;
        width: 100% !important;
    }

    .hero-title {
        order: 1 !important;
    }

    .hero-subtitle {
        order: 2 !important;
    }

    .hero-stats {
        order: 3 !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        width: 100% !important;
        margin: 0 !important;
    }

    .cta-buttons {
        order: 4 !important;
        width: 100% !important;
    }
}

@media (max-width: 768px) {
    .navbar {
        position: sticky !important;
    }

    .nav-container {
        padding: 0 1rem !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
        flex-direction: column !important;
    }

    .nav-links {
        display: flex !important;
        width: 100% !important;
        gap: 0.3rem !important;
        overflow-x: auto !important;
        padding-bottom: 0.35rem !important;
    }

    .nav-links a {
        white-space: nowrap !important;
        padding: 0.42rem 0.68rem !important;
    }

    .hero {
        padding: 4.5rem 1rem 3.5rem !important;
    }

    .hero-title {
        font-size: clamp(2.7rem, 15vw, 4.2rem) !important;
    }

    .cta-buttons,
    .project-links {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .btn,
    .project-link {
        justify-content: center !important;
    }

    .about,
    .projects,
    .skills,
    .blog,
    .contact {
        padding: 4rem 1rem !important;
    }
}
