﻿:root {
    /* Sunrise & Deep Sea Palette - Energetic, Trustworthy & Modern */
    --primary: #1A3263;
    --primary-dim: #ecf3ff;
    --accent: #C66A18;
    /* Darker caramel for readable accents (was #FFC570) */
    --accent-soft: #FFC570;
    /* Soft amber for blocks / buttons only */
    --secondary: #547792;
    --text-main: #1A3263;
    --text-body: #334155;
    --text-muted: #64748b;

    --bg-base: #FCF6F0;
    --bg-paper: #ffffff;
    --bg-surface: #FAF2EB;
    --border: #EFD2B0;

    --shadow-soft: 0 4px 20px -5px rgba(0, 0, 0, 0.05);
    --shadow-paper: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --radius: 4px;
    --max-width: 1200px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --header-height: 64px;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Noto Sans TC', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: var(--bg-base);
    color: var(--text-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
}

/* ========== Header / Nav ========== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--header-height);
    position: relative;
}

.nav-brand {
    display: flex;
    flex-direction: column;
    gap: 0;
    line-height: 1.2;
}

.nav-brand h1 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
}

.nav-brand .nav-role {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 8px;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    z-index: 110;
}

.nav-toggle .bar {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
    transition: var(--transition);
}

.nav-toggle.active .bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.active .bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active .bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

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

.nav-menu a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.language-switcher {
    display: flex;
    gap: 0.5rem;
    padding-left: 1rem;
    border-left: 1px solid var(--border);
    align-items: center;
}

.lang-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.lang-btn.active {
    color: var(--primary);
}

.nav-menu a:hover,
.nav-menu a.active,
.lang-btn:hover {
    color: var(--primary);
}

.nav-pdf {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent) !important;
}

.nav-github {
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: var(--transition);
}

.nav-github:hover {
    color: var(--primary);
}

/* Collapse nav earlier to avoid crowding on small laptops / tablet landscape */
@media (max-width: 900px) {
    .nav-brand .nav-role {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: rgba(255, 255, 255, 0.98);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-soft);
        padding: 0.5rem 0 1rem;
        z-index: 100;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-menu li {
        width: 100%;
    }

    .nav-menu a,
    .nav-menu .lang-btn {
        display: block;
        padding: 0.85rem 1.5rem;
        width: 100%;
        text-align: left;
    }

    .language-switcher {
        border-left: none;
        padding: 0.5rem 1.5rem;
        gap: 1rem;
    }

    .nav-github {
        padding: 0.85rem 1.5rem;
        display: inline-block;
    }
}

/* ========== Hero ========== */
.hero {
    padding: 72px 0 64px;
    border-bottom: 1px solid var(--border);
    background:
        radial-gradient(ellipse 80% 60% at 100% 0%, rgba(198, 106, 24, 0.06), transparent 55%),
        radial-gradient(ellipse 60% 50% at 0% 100%, rgba(26, 50, 99, 0.05), transparent 50%),
        var(--bg-base);
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 3rem;
    align-items: center;
    max-width: 1000px;
    margin: 0 auto;
}

.hero-text {
    text-align: left;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 1.25rem;
    border-left: 4px solid var(--accent-soft);
    padding-left: 12px;
}

.hero-description {
    font-size: 1.05rem;
    color: var(--text-body);
    margin-bottom: 2rem;
    max-width: 560px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    align-items: center;
}

.hero-image {
    flex-shrink: 0;
}

.avatar-container {
    width: 200px;
    height: auto;
    border-radius: 12px;
    overflow: hidden;
    border: 4px solid #ffffff;
    box-shadow: 0 8px 24px rgba(26, 50, 99, 0.12);
}

.avatar-image {
    width: 100%;
    height: auto;
    display: block;
}

@media (max-width: 768px) {
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }

    .hero-text {
        text-align: center;
        order: 2;
    }

    .hero-image {
        order: 1;
        margin: 0 auto;
    }

    .hero-subtitle {
        border-left: none;
        border-bottom: 3px solid var(--accent-soft);
        display: inline-block;
        padding-left: 0;
        padding-bottom: 0.35rem;
    }

    .hero-description {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-actions {
        justify-content: center;
    }

    .avatar-container {
        width: 160px;
    }
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    font-family: inherit;
}

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

.btn-primary:hover {
    background-color: var(--primary);
    color: white;
}

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

.btn-secondary:hover {
    background-color: var(--bg-surface);
}

.btn-icon {
    width: 42px;
    height: 42px;
    padding: 0;
    justify-content: center;
    border: 1px solid var(--border);
    color: var(--text-main);
    background: var(--bg-paper);
    border-radius: var(--radius);
}

.btn-icon:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ========== Highlights ========== */
.highlights {
    padding: 40px 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-paper);
}

.highlights-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    text-align: center;
}

.highlight-item strong {
    display: block;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.highlight-item span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .highlights-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
}

/* ========== Sections ========== */
section {
    padding: 60px 0;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 auto 3rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
    display: table;
    text-align: center;
}

.section-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: -1.5rem;
    margin-bottom: 3rem;
}

/* ========== About ========== */
.about-text {
    max-width: 800px;
    margin: 0 auto;
    text-align: left;
}

.about-text p {
    margin-bottom: 1.25rem;
}

.about-extra {
    display: none;
}

.about-text.is-expanded .about-extra {
    display: block;
}

.about-toggle {
    display: inline-flex;
    margin-top: 0.5rem;
    background: none;
    border: none;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
}

.about-toggle:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* ========== Skills cards ========== */
.skills-lead {
    text-align: center;
    max-width: 640px;
    margin: -1.5rem auto 2.5rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--primary);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    max-width: 960px;
    margin: 0 auto;
}

.skill-card {
    background: var(--bg-surface);
    padding: 1.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-paper);
    transition: var(--transition);
}

.skill-card:hover {
    border-color: var(--secondary);
    box-shadow: var(--shadow-soft);
}

.skill-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-main);
    border-bottom: 2px solid var(--primary-dim);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.skill-card-header i {
    color: var(--accent);
    font-size: 1.1rem;
}

.skill-card ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.skill-card li {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-body);
    padding: 0.5rem 0.75rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    border-left: 4px solid var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.skill-card li small {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .skills-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== Projects ========== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.project-card {
    background: var(--bg-surface);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.project-card.featured {
    grid-column: 1 / -1;
    background:
        linear-gradient(135deg, rgba(26, 50, 99, 0.04), transparent 40%),
        var(--bg-paper);
    border-color: var(--secondary);
    box-shadow: var(--shadow-soft);
}

.project-card.featured .project-layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 2rem;
    align-items: start;
}

.project-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--primary);
    background: var(--accent-soft);
    padding: 0.25rem 0.6rem;
    border-radius: 3px;
    margin-bottom: 0.75rem;
}

.project-visual {
    background: var(--bg-base);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    min-height: 200px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.75rem;
}

.flow-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
}

.flow-step .flow-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.flow-arrow {
    color: var(--accent);
    font-size: 0.85rem;
    padding-left: 0.35rem;
}

.project-header h3 {
    font-size: 1.25rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.project-card.featured .project-header h3 {
    font-size: 1.45rem;
}

.tag {
    font-size: 0.75rem;
    color: white;
    background: var(--secondary);
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 0.5rem;
    display: inline-block;
    margin-bottom: 0.35rem;
}

.project-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.project-features {
    margin-top: 1rem;
    list-style: none;
}

.project-features li {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    padding-left: 1.25rem;
    position: relative;
}

.project-features li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent);
}

.project-actions {
    margin-top: auto;
    padding-top: 1.5rem;
    display: flex;
    gap: 1rem;
}

.btn-github {
    background: var(--bg-paper);
    border: 1px solid var(--border);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-paper);
}

.btn-github:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-dim);
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

@media (max-width: 900px) {
    .project-card.featured .project-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== Timeline ========== */
.timeline {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
}

.timeline-item {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 1.5rem;
    padding-bottom: 2.5rem;
    position: relative;
}

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

.timeline-aside {
    text-align: right;
    padding-top: 0.15rem;
}

.timeline-date {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary);
    display: block;
}

.timeline-main {
    border-left: 1px solid var(--border);
    padding-left: 1.75rem;
    position: relative;
}

.timeline-marker {
    position: absolute;
    left: -5px;
    top: 8px;
    width: 9px;
    height: 9px;
    background: var(--primary);
    border-radius: 50%;
}

.timeline-header h3 {
    font-size: 1.1rem;
    color: var(--text-main);
}

.timeline-company {
    display: block;
    font-weight: 600;
    color: var(--secondary);
    font-size: 0.95rem;
}

.timeline-details {
    margin-top: 0.75rem;
    list-style: disc;
    padding-left: 1.25rem;
    font-size: 0.9rem;
}

.timeline-details p {
    font-size: 0.9rem;
}

@media (max-width: 640px) {
    .timeline-item {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .timeline-aside {
        text-align: left;
        padding-left: 1.75rem;
    }

    .timeline-date {
        font-size: 0.8rem;
    }
}

/* ========== Contact ========== */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.contact-item {
    background: var(--bg-surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    transition: var(--transition);
}

.contact-item:hover {
    border-color: var(--primary);
}

.contact-item i {
    font-size: 1.25rem;
    color: var(--accent);
}

.contact-item h4 {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.contact-item p {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
}

.contact-link {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.contact-link:hover {
    color: var(--primary);
}

.contact-cta {
    margin-top: 3rem;
    text-align: center;
    padding: 2.5rem;
    background: var(--bg-surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.contact-cta h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.contact-cta-note {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

.contact-cta-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

/* ========== Footer ========== */
.footer {
    padding: 40px 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* ========== Animations (progressive enhancement) ========== */
.js .reveal-item {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s cubic-bezier(0.2, 0.8, 0.2, 1),
        transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.js .reveal-item.is-visible {
    opacity: 1;
    transform: none;
}

.js .stagger-reveal > * {
    opacity: 0;
    transform: translateY(12px);
}

.js .stagger-reveal.is-visible > *:nth-child(1) {
    animation: paperReveal 0.7s 0.05s forwards;
}

.js .stagger-reveal.is-visible > *:nth-child(2) {
    animation: paperReveal 0.7s 0.12s forwards;
}

.js .stagger-reveal.is-visible > *:nth-child(3) {
    animation: paperReveal 0.7s 0.19s forwards;
}

.js .stagger-reveal.is-visible > *:nth-child(4) {
    animation: paperReveal 0.7s 0.26s forwards;
}

.js .stagger-reveal.is-visible > *:nth-child(5) {
    animation: paperReveal 0.7s 0.33s forwards;
}

@keyframes paperReveal {
    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .js .reveal-item,
    .js .stagger-reveal > * {
        opacity: 1 !important;
        transform: none !important;
    }
}
