@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* Reset & Variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0b0f14;
    --bg-card: #121923;
    --bg-card-hover: #17212d;
    --primary: #22d3ee;
    --secondary: #64748b;
    --accent: #f87171;
    --text-main: #f1f5f9;
    --text-muted: #b6c2d0;
    --border-glass: #263545;
    --glow-primary: 0 0 16px rgba(34, 211, 238, 0.18);
    --glow-secondary: 0 0 12px rgba(100, 116, 139, 0.12);
}

html {
    scroll-behavior: smooth;
    background-color: var(--bg-dark);
}

body {
    font-family: 'Outfit', "Microsoft YaHei", "Noto Sans SC", sans-serif;
    color: var(--text-main);
    line-height: 1.6;
    background-image: linear-gradient(180deg, rgba(34, 211, 238, 0.025), transparent 32%);
    background-attachment: fixed;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: 2;
}

/* Glassmorphism Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(11, 15, 20, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-glass);
    z-index: 1000;
    padding: 1.2rem 0;
    transition: all 0.3s ease;
}

.navbar.scrolled {
    padding: 0.8rem 0;
    background: rgba(11, 15, 20, 0.98);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: 1px;
    position: relative;
}

.logo span {
    color: var(--primary);
    background: none;
    -webkit-background-clip: text;
    -webkit-text-fill-color: currentColor;
    text-shadow: 0 0 12px rgba(34, 211, 238, 0.18);
}

.nav-links {
    display: flex;
    gap: 2.5rem;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background: var(--primary);
    transition: width 0.3s;
    box-shadow: none;
}

.nav-links a:hover {
    color: var(--text-main);
}

.nav-links a:hover::after {
    width: 100%;
}

/* Mobile Menu */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

.hamburger span {
    display: block;
    width: 30px;
    height: 2px;
    background: var(--text-main);
    transition: 0.3s;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 80px;
    position: relative;
    overflow: hidden;
}

/* Low-contrast character flow: adds depth without competing with the hero copy. */
.hero-character-flow {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.58;
    mix-blend-mode: screen;
}

.hero::before {
    content: '';
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 460px;
    height: 460px;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.07) 0%, transparent 65%);
    z-index: 0;
    pointer-events: none;
}

.hero-content {
    max-width: 800px;
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 4.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    letter-spacing: -1px;
    white-space: nowrap;
}

.hero h1 .highlight {
    color: var(--primary);
    background: none;
    -webkit-background-clip: text;
    -webkit-text-fill-color: currentColor;
    display: inline-block;
}

/* Designed monogram treatment for the public-facing hero name. */
.hero-name {
    position: relative;
    margin-left: 0.12em;
    font-size: 1.68em;
    width: 3.075em;
    height: 0.78em;
    line-height: 0;
    vertical-align: -0.06em;
    white-space: nowrap;
    animation: hero-name-in 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.hero-name::after {
    display: none;
}

.hero-name-glyphs {
    position: absolute;
    top: 0.06em;
    left: 0;
    display: block;
    width: 100%;
    height: 1em;
    overflow: visible;
    fill: currentColor;
    stroke: rgba(34, 211, 238, 0.28);
    stroke-width: 8;
    paint-order: stroke fill;
    animation: hero-name-breathe 4s ease-in-out 1s infinite;
}

.hero-name-signature {
    position: absolute;
    left: 0.02em;
    top: calc(100% + 0.26em);
    width: 112%;
    height: 0.26em;
    overflow: visible;
    transform: rotate(-5deg);
    transform-origin: left center;
    pointer-events: none;
}

.hero-name-signature path {
    fill: none;
    stroke: var(--primary);
    stroke-width: 3.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 230;
    stroke-dashoffset: 230;
    animation: hero-name-line 0.75s 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes hero-name-in {
    from { opacity: 0; transform: translateY(0.35em) scale(0.94); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes hero-name-line {
    from { stroke-dashoffset: 230; opacity: 0; }
    to { stroke-dashoffset: 0; opacity: 1; }
}

@keyframes hero-name-breathe {
    0%, 100% { filter: drop-shadow(0 8px 11px rgba(34, 211, 238, 0.14)); }
    50% { filter: drop-shadow(0 10px 14px rgba(34, 211, 238, 0.28)); }
}

.subtitle {
    font-size: 1.8rem;
    color: var(--text-muted);
    font-weight: 300;
    margin-bottom: 1rem;
}

.description {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    max-width: 600px;
}

/* Buttons */
.hero-buttons {
    display: flex;
    gap: 1.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    border-radius: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--text-main);
    color: var(--bg-dark);
    box-shadow: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.btn-outline {
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    background: var(--bg-card);
    backdrop-filter: none;
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: none;
    transform: translateY(-2px);
}

/* Sections */
.section {
    padding: 120px 0;
    position: relative;
}

.section-alt {
    background: rgba(255, 255, 255, 0.015);
    border-top: 1px solid var(--border-glass);
    border-bottom: 1px solid var(--border-glass);
}

.section-title {
    font-size: 3rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 4rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.section-title span {
    color: var(--primary);
}

/* Experience highlight */
.experience-section {
    padding-top: 72px;
    padding-bottom: 72px;
}

.experience-card {
    padding: 2rem 2.25rem;
    border: 1px solid rgba(34, 211, 238, 0.28);
    border-radius: 16px;
    background: #14202b;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.experience-heading {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.experience-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: 12px;
    color: var(--bg-dark);
    background: var(--primary);
    font-size: 1.4rem;
}

.eyebrow {
    margin-bottom: 0.15rem;
    color: var(--primary);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.experience-heading h2 {
    font-size: 1.45rem;
}

.experience-heading h2 span {
    color: var(--text-muted);
    font-weight: 400;
}

.experience-status {
    margin-left: auto;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border-glass);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.experience-summary {
    max-width: 760px;
    margin: 1.25rem 0 1.15rem 60px;
    color: var(--text-muted);
}

.experience-points {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    margin-left: 60px;
    color: var(--text-main);
    font-size: 0.9rem;
}

.experience-points i {
    margin-right: 0.3rem;
    color: var(--primary);
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2.5rem;
}

/* Keep the strongest, most recent projects first in the portfolio grid. */
.project-p4 { order: 1; }
.project-watch { order: 2; }
.project-drone { order: 3; }
.project-signal { order: 4; }
.project-android { order: 5; }

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: none;
    transition: border-color 0.25s, background 0.25s, transform 0.25s;
    position: relative;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}

.project-card:hover {
    transform: translateY(-4px);
    border-color: rgba(34, 211, 238, 0.5);
    background: var(--bg-card-hover);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
}

.project-card:hover::before {
    opacity: 0;
}

.project-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/10;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
    filter: brightness(0.9) contrast(1.08);
}

.project-card:hover .project-image img {
    transform: scale(1.03);
    filter: brightness(1) contrast(1.08);
}

.project-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: none;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.4s;
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.btn-small {
    padding: 10px 24px;
    font-size: 0.9rem;
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 30px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
}

.btn-small:hover {
    background: var(--primary);
    color: var(--bg-dark);
    box-shadow: var(--glow-primary);
}

.project-info {
    padding: 2rem;
}

.project-info h3 {
    font-size: 1.4rem;
    margin-bottom: 0.8rem;
    font-weight: 700;
}

.project-info p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.project-tags span {
    padding: 4px 14px;
    background: rgba(34, 211, 238, 0.08);
    color: var(--primary);
    border: 1px solid rgba(34, 211, 238, 0.22);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Skills */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.skill-category {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    padding: 2.5rem;
    border-radius: 16px;
    backdrop-filter: none;
    transition: transform 0.3s, border-color 0.3s;
}

.skill-category:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: none;
}

.skill-category h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.skill-category h3::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: none;
}

.skill-category ul {
    list-style: none;
}

.skill-category li {
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

.skill-category li:last-child {
    border-bottom: none;
}

/* About */
.about-content {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 4rem;
    align-items: center;
}

.about-image {
    position: relative;
}

.about-image::before {
    content: '';
    position: absolute;
    inset: -15px;
    background: var(--primary);
    border-radius: 20px;
    z-index: -1;
    filter: blur(14px);
    opacity: 0.18;
}

.about-image img {
    width: 100%;
    border-radius: 16px;
    border: 2px solid var(--border-glass);
}

.about-text p {
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    font-size: 1.15rem;
}

.about-stats {
    display: flex;
    gap: 3rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-glass);
}

.stat-number {
    display: block;
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary);
    background: none;
    -webkit-background-clip: text;
    -webkit-text-fill-color: currentColor;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Contact */
.contact-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.contact-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 3rem 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.3s;
    text-align: center;
}

.contact-item svg {
    width: 48px;
    height: 48px;
    color: var(--primary);
    margin-bottom: 1rem;
    transition: transform 0.3s;
}

.contact-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
    box-shadow: none;
    transform: translateY(-3px);
}

.contact-item:hover svg {
    transform: scale(1.1);
}

.contact-item span {
    font-size: 1.1rem;
    font-weight: 500;
}

/* Footer */
.footer {
    background: #050508;
    color: var(--text-muted);
    text-align: center;
    padding: 3rem 0;
    border-top: 1px solid var(--border-glass);
}

/* Glow Mouse Effect */
.mouse-glow {
    position: fixed;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.06) 0%, transparent 65%);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 9999;
    transition: left 0.1s ease-out, top 0.1s ease-out;
}

/* Responsive */
@media (max-width: 992px) {
    .hero h1 { font-size: 3.5rem; }
    .about-content { grid-template-columns: 1fr; }
    .about-image { max-width: 500px; margin: 0 auto 3rem; }
}

@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 100vh;
        width: auto;
        display: none;
        background: rgba(11, 15, 20, 0.98);
        backdrop-filter: blur(12px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transition: opacity 0.2s ease;
    }

    .nav-links.active {
        display: flex;
    }

    .hamburger {
        display: flex;
    }

    .hamburger.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .hamburger.active span:nth-child(2) { opacity: 0; }
    .hamburger.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

    .hero h1 { font-size: 2.8rem; }
    .hero-name { font-size: 1.46em; }
    .hero-name-glyphs { top: 0.06em; }
    .hero-name-signature { top: calc(100% + 0.26em); width: 116%; }
    .hero-character-flow { opacity: 0.34; }
    .section-title { font-size: 2.2rem; }
    .about-stats { flex-direction: column; align-items: center; gap: 2rem; }
    .projects-grid,
    .skills-grid { grid-template-columns: minmax(0, 1fr); }
    .project-overlay { opacity: 1; inset: auto 0 0; height: 54px; justify-content: flex-end; padding: 0.7rem 1rem; background: linear-gradient(transparent, rgba(10, 10, 15, 0.9)); backdrop-filter: none; }
    .project-card:focus-within .project-overlay { opacity: 1; }
    .skill-category { padding: 1.75rem; }
    .experience-card { padding: 1.5rem; }
    .experience-summary,
    .experience-points { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .hero-name,
    .hero-name-glyphs,
    .hero-name-signature path { animation: none; stroke-dashoffset: 0; }
}

@media (max-width: 480px) {
    .container { padding: 0 1.25rem; }
    .hero h1 { white-space: normal; }
    .hero-buttons { flex-direction: column; align-items: stretch; gap: 0.75rem; }
    .hero-buttons .btn { width: 100%; }
    .experience-heading { align-items: flex-start; }
    .experience-heading h2 { font-size: 1.2rem; }
    .experience-status { display: none; }
    .experience-points { flex-direction: column; gap: 0.5rem; }
}

@media (pointer: coarse) {
    .mouse-glow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
