/* =============================================================================
   MyResume — Main Stylesheet
   Modern, professional senior-engineer portfolio. No decorative excess.
   ============================================================================= */

/* 1. Design tokens */
:root {
    --ink: #0f1c33;
    --ink-2: #182a4a;
    --ink-3: #24407a;
    --text: #3d4a5f;
    --muted: #6b7a90;
    --bg: #f4f7fb;
    --surface: #ffffff;
    --border: #e3e9f2;
    --accent: #0f62fe;
    --accent-dark: #0a48c4;
    --accent-soft: rgba(15, 98, 254, 0.08);
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(15, 28, 51, 0.05), 0 10px 30px -12px rgba(15, 28, 51, 0.18);
    --shadow-sm: 0 1px 2px rgba(15, 28, 51, 0.06), 0 6px 16px -10px rgba(15, 28, 51, 0.14);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
}

/* 2. Reset / base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-dark);
    text-decoration: underline;
}

h1, h2, h3, h4, h5 {
    color: var(--ink);
    line-height: 1.25;
    font-weight: 700;
}

p {
    margin-bottom: 0.5rem;
}

ul {
    list-style: none;
}

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.skip-link {
    position: absolute;
    top: -60px;
    left: 12px;
    z-index: 200;
    padding: 10px 16px;
    background: var(--ink);
    color: #fff;
    border-radius: 0 0 8px 8px;
    transition: top 0.15s ease;
}

.skip-link:focus {
    top: 0;
    color: #fff;
    text-decoration: none;
}

.container {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 24px;
}

section {
    scroll-margin-top: 88px;
}

/* 3. Top navigation */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    min-height: 64px;
}

.brand {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--ink);
    white-space: nowrap;
}

.brand:hover {
    text-decoration: none;
    color: var(--accent);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.nav-links a {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14.5px;
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--accent);
    background: var(--accent-soft);
    text-decoration: none;
}

.nav-links a.active {
    color: var(--accent);
    background: var(--accent-soft);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 8px;
}

.lang-toggle {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    background: var(--surface);
}

.lang-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    margin-left: auto;
    padding: 10px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--ink);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* 4. Hero */
.hero {
    background: radial-gradient(1200px 500px at 85% -10%, rgba(36, 64, 122, 0.85), transparent 60%),
        linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 60%, #142650 100%);
    color: #dbe4f4;
    padding: 88px 0 72px;
    overflow: hidden;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 56px;
    align-items: center;
}

.hero h1 {
    color: #ffffff;
    font-size: clamp(34px, 5vw, 54px);
    letter-spacing: 0.02em;
    line-height: 1.08;
}

.hero h1 .name-zh {
    font-size: 0.55em;
    color: #7fb0ff;
    margin-left: 14px;
    white-space: nowrap;
}

.hero-title {
    margin-top: 14px;
    font-size: clamp(17px, 2.2vw, 22px);
    font-weight: 600;
    color: #7fb0ff;
}

.hero-rotating {
    margin-top: 6px;
    font-size: clamp(14px, 1.8vw, 17px);
    color: #9db4d8;
    min-height: 1.6em;
}

.hero-statement {
    margin: 22px 0 30px;
    font-size: 17px;
    line-height: 1.75;
    color: #c6d3ea;
    max-width: 620px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hero-photo {
    position: relative;
}

.hero-photo img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.55);
    background: var(--ink-2);
}

.hero-meta {
    margin-top: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hero-meta .chip {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #dbe4f4;
    font-size: 13.5px;
    padding: 6px 14px;
}

/* 5. Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn:hover {
    text-decoration: none;
}

.btn:active {
    transform: translateY(1px);
}

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

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: #e6edf9;
    border: 1px solid rgba(255, 255, 255, 0.28);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

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

.btn-outline:hover {
    background: var(--accent-soft);
    color: var(--accent-dark);
}

/* 6. Sections */
.section {
    padding: 72px 0;
}

.section-alt {
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.section-head {
    margin-bottom: 40px;
}

.section-kicker {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 8px;
}

.section-head h2 {
    font-size: clamp(26px, 3.4vw, 34px);
}

.section-head p {
    margin-top: 10px;
    color: var(--muted);
    max-width: 640px;
    font-size: 15.5px;
}

.section-head-gap {
    margin-top: 56px;
}

/* 7. About */
.about-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 40px;
    align-items: start;
}

.about-text {
    font-size: 16.5px;
}

.about-highlights {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.highlight {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}

.highlight strong {
    display: block;
    font-size: 22px;
    color: var(--accent);
    line-height: 1.2;
}

.highlight span {
    font-size: 13.5px;
    color: var(--muted);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.service-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.service-card .icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 14px;
}

.service-card h3 {
    font-size: 16.5px;
    margin-bottom: 8px;
}

.service-card p {
    font-size: 14.5px;
    color: var(--muted);
}

/* 8. Skills */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.skill-cat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
}

.skill-cat h3 {
    font-size: 15.5px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.skill-cat ul li {
    font-size: 14px;
    padding: 5px 0 5px 20px;
    position: relative;
    color: var(--text);
}

.skill-cat ul li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 13px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.7;
}

/* 9. Experience timeline */
.timeline {
    position: relative;
    max-width: 860px;
    margin: 0 auto;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 118px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 118px 1fr;
    gap: 32px;
    padding: 6px 0 34px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: 113px;
    top: 10px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--surface);
    border: 3px solid var(--accent);
    z-index: 1;
}

.timeline-period {
    text-align: right;
    padding-top: 2px;
}

.timeline-period .badge {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid rgba(15, 98, 254, 0.25);
    border-radius: 999px;
    padding: 4px 12px;
}

.timeline-body {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
}

.timeline-body h3 {
    font-size: 17px;
}

.timeline-body .company {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    margin: 2px 0 10px;
}

.timeline-body ul {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 20px;
}

.timeline-body ul li {
    font-size: 14.5px;
    padding-left: 18px;
    position: relative;
}

.timeline-body ul li::before {
    content: "›";
    position: absolute;
    left: 2px;
    color: var(--accent);
    font-weight: 700;
}

/* 10. Featured projects */
.projects-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 22px;
}

.project-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.project-thumb {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 108px;
    padding: 16px;
    background: linear-gradient(135deg, #eef3fb, #e2eaf8);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}

.project-thumb img {
    height: 76px;
    width: 76px;
    object-fit: contain;
    border-radius: 10px;
    background: #fff;
    padding: 6px;
    box-shadow: var(--shadow-sm);
}

.project-thumb .placeholder {
    height: 76px;
    width: 76px;
    border-radius: 10px;
    background: var(--ink);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 30px;
    font-weight: 700;
}

.project-body {
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.project-body h3 {
    font-size: 17px;
}

.project-domain {
    align-self: flex-start;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent-dark);
    background: var(--accent-soft);
    border-radius: 999px;
    padding: 4px 12px;
}

.project-overview {
    font-size: 14.5px;
    color: var(--text);
}

.project-body h4 {
    font-size: 13.5px;
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.project-resp {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.project-resp li {
    font-size: 12.5px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px 10px;
    color: var(--text);
}

.project-tech {
    font-size: 13.5px;
    color: var(--accent-dark);
    font-weight: 600;
}

.project-impact {
    font-size: 14px;
    color: var(--ink);
    border-left: 3px solid var(--accent);
    background: var(--accent-soft);
    border-radius: 0 8px 8px 0;
    padding: 8px 12px;
}

/* 11. Additional projects */
.add-projects {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.add-project {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    box-shadow: var(--shadow-sm);
}

.add-project img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 8px;
    background: var(--bg);
    padding: 3px;
}

.add-project .placeholder {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--ink);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 14px;
    font-weight: 700;
    flex: none;
}

.add-project .meta {
    min-width: 0;
}

.add-project .meta strong {
    display: block;
    font-size: 13.5px;
    color: var(--ink);
    line-height: 1.35;
}

.add-project .meta span {
    font-size: 11.5px;
    color: var(--muted);
}

/* 12. Contact */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.contact-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.contact-card .icon {
    width: 46px;
    height: 46px;
    margin: 0 auto 14px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 20px;
    font-weight: 700;
}

.contact-card h3 {
    font-size: 14px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.contact-card a,
.contact-card p {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    word-break: break-word;
}

.contact-note {
    margin-top: 32px;
    text-align: center;
}

/* 13. Footer */
.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 26px 0;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13.5px;
    color: var(--muted);
}

.footer-links a {
    font-size: 13.5px;
    font-weight: 600;
    margin-left: 18px;
}

/* 14. Responsive */
@media (max-width: 1024px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .hero-photo {
        max-width: 320px;
        margin: 0 auto;
    }

    .skills-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .contact-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .add-projects {
        grid-template-columns: repeat(2, 1fr);
    }

    .nav-links {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
        padding: 10px 16px 16px;
        transform: translateY(-12px);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    }

    .nav-links.open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .nav-links a {
        padding: 12px 10px;
        font-size: 15px;
    }

    .nav-toggle {
        display: flex;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 15px;
    }

    .section {
        padding: 56px 0;
    }

    .hero {
        padding: 56px 0 48px;
    }

    .about-grid {
        grid-template-columns: 1fr;
    }

    .about-highlights {
        grid-template-columns: repeat(2, 1fr);
    }

    .services-grid {
        grid-template-columns: 1fr;
    }

    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .projects-list {
        grid-template-columns: 1fr;
    }

    .timeline {
        padding-left: 6px;
    }

    .timeline::before {
        left: 10px;
    }

    .timeline-item {
        grid-template-columns: 1fr;
        gap: 12px;
        padding-left: 34px;
    }

    .timeline-item::before {
        left: 5px;
        top: 8px;
    }

    .timeline-period {
        text-align: left;
        padding-top: 0;
    }

    .timeline-body ul {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .skills-grid,
    .add-projects,
    .contact-grid {
        grid-template-columns: 1fr;
    }

    .about-highlights {
        grid-template-columns: 1fr;
    }

    .hero-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .brand {
        font-size: 13.5px;
    }

    .nav-actions {
        margin-left: 0;
        gap: 8px;
    }

    .nav-actions .btn-primary {
        display: none;
    }

    .nav-toggle {
        width: 40px;
        height: 40px;
        padding: 9px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}
