/* =========================================
   全局重置與基本設定
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 主色系 */
    --primary-color: #355872;
    --primary-light: #527A9B;
    --primary-dark: #1E374A;
    /* 次要/灰階色系 */
    --secondary-color: #64748B;
    --secondary-light: #E2E8F0;
    /* 文字與背景 */
    --text-main: #0f172a;
    --text-light: #475569;
    --bg-main: #f1f5f9;
    --bg-alt: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.9);
    --input-border: #cbd5e1;
    /* 語意色彩 */
    --color-success: #10B981;
    --color-error: #EF4444;
    --color-warning: #F59E0B;
}

body {
    font-family: 'IBM Plex Sans JP', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.7;
    /* 內文行高優化 */
    letter-spacing: 0.02em;
    /* 字距微調 */
    scroll-behavior: smooth;
}

pre,
code {
    font-family: 'Fira Code', 'JetBrains Mono', monospace;
}

/* 預設手機版字級階層 */
h1,
h2,
h3,
h4 {
    color: var(--primary-dark);
    font-weight: 700;
    line-height: 1.3;
}

h1 {
    font-size: 2.2rem;
}

h2 {
    font-size: 1.8rem;
}

h3 {
    font-size: 1.3rem;
}

h4 {
    font-size: 1.1rem;
}

.text-small {
    font-size: 0.875rem;
    color: var(--text-light);
}

.text-caption {
    font-size: 0.75rem;
    color: var(--secondary-color);
}

/* =========================================
   導覽列設定 (手機預設)
   ========================================= */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 1000;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 1px;
}

.logo img {
    height: 28px;
    width: auto;
    object-fit: contain;
}

.menu-toggle {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
    z-index: 1001;
}

.menu-toggle .bar {
    width: 25px;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 3px;
    transition: all 0.2s ease;
}

.menu-toggle.is-active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.menu-toggle.is-active .bar:nth-child(2) {
    opacity: 0;
}

.menu-toggle.is-active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.nav-links {
    list-style: none;
    display: none;
    flex-direction: column;
    width: 100%;
    text-align: center;
    background-color: var(--glass-bg);
    margin-top: 1rem;
    padding: 1rem 0;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.nav-links.active {
    display: flex;
    animation: fadeInDown 0.3s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-links a {
    display: block;
    padding: 0.5rem 0;
    text-decoration: none;
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* =========================================
   區塊通用設定
   ========================================= */
.section {
    padding: 3rem 5%;
}

.bg-light {
    background-color: var(--bg-alt);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 2.5rem;
    color: var(--primary-color);
    font-weight: 700;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background-color: var(--secondary-color);
    margin: 0.8rem auto 0;
}

/* =========================================
   首頁 - Hero 區塊
   ========================================= */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding-top: 100px;
    padding-bottom: 3rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.hero-content {
    padding: 0 5%;
}

.hero-content h1 {
    font-size: 2.2rem;
    margin-bottom: 1rem;
    color: var(--primary-dark);
}

.hero-content p {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 2rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.highlight {
    color: var(--primary-color);
}

/* 商務風按鈕 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    letter-spacing: 0.05em;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-family: inherit;
}

.btn:hover {
    background-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn.secondary {
    background-color: var(--secondary-color);
}

.btn.secondary:hover {
    background-color: var(--text-light);
}

/* =========================================
   時間軸 (學歷/經歷)
   ========================================= */
.timeline {
    border-left: 2px solid var(--primary-color);
    margin-left: 10px;
    padding-left: 20px;
}

.timeline-item {
    margin-bottom: 2rem;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -26px;
    top: 5px;
    width: 10px;
    height: 10px;
    border: 2px solid var(--primary-color);
    background-color: var(--bg-main);
    border-radius: 50%;
}

.timeline-item h3 {
    margin-bottom: 0.2rem;
    color: var(--primary-dark);
}

.date {
    color: var(--secondary-color);
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

/* =========================================
   網格 (專案作品)
   ========================================= */
.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.project-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.project-card {
    background: var(--bg-alt);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    height: 100%;
}

.project-link:hover .project-card {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-5px);
}

.project-img {
    height: 180px;
    width: 100%;
    object-fit: cover;
    display: block;
    background-color: #e2e8f0;
}

.project-info {
    padding: 1.2rem;
}

.project-info h3 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.project-info h3::after {
    content: '\f061';
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 1rem;
    color: var(--primary-light);
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.2s ease;
}

.project-link:hover .project-info h3::after {
    opacity: 1;
    transform: translateX(0);
}

.project-info p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* =========================================
   聯絡我表單 (Contact Form)
   ========================================= */
.contact-form {
    max-width: 100%;
    margin: 0 auto;
    background: var(--bg-alt);
    padding: 2rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    background-color: var(--bg-main);
    color: var(--text-main);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(53, 88, 114, 0.1);
}

.btn-submit {
    width: 100%;
    margin-top: 1rem;
}

/* =========================================
   專案內頁細節樣式
   ========================================= */
.project-detail-hero {
    position: relative;
    padding: 120px 5% 4rem 5%;
    text-align: center;
    background-color: var(--text-main);
    background-size: cover;
    background-position: center;
    background-attachment: scroll;
    z-index: 1;
}

.project-detail-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.8);
    z-index: -1;
}

.project-detail-hero p {
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.project-detail-hero h1 {
    color: white;
    margin-bottom: 1rem;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.6);
}

.project-detail-hero .badge {
    display: inline-block;
    padding: 5px 15px;
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(4px);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.project-detail-content {
    max-width: 100%;
    padding: 2rem 5%;
}

.project-detail-content h3 {
    font-size: 1.3rem;
    margin: 1.8rem 0 1rem;
    border-left: 4px solid var(--primary-color);
    padding-left: 10px;
}

.project-detail-content p,
.project-detail-content ul {
    color: var(--text-light);
    margin-bottom: 1.2rem;
    font-size: 1rem;
}

.project-detail-content ul {
    padding-left: 20px;
}

.project-detail-content li {
    margin-bottom: 0.5rem;
}

.back-btn {
    display: inline-block;
    margin-top: 2rem;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
}

.back-btn:hover {
    text-decoration: underline;
}

/* =========================================
   進場微動畫
   ========================================= */
.fade-in {
    opacity: 0;
    transform: translateY(15px);
    animation: fadeInUp 0.8s ease forwards;
}

.delay-1 {
    animation-delay: 0.2s;
}

.delay-2 {
    animation-delay: 0.4s;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   頁尾
   ========================================= */
.footer {
    text-align: center;
    padding: 2rem;
    background: var(--text-main);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    border-top: 5px solid var(--primary-color);
}


/* =========================================
   響應式設計：Tablet (Min-width: 768px)
   ========================================= */
@media (min-width: 768px) {

    /* 字級放大 */
    h1 {
        font-size: 2.8rem;
    }

    h2 {
        font-size: 2rem;
    }

    h3 {
        font-size: 1.5rem;
    }

    h4 {
        font-size: 1.25rem;
    }

    /* 導覽列改為橫排 */
    .navbar {
        flex-wrap: nowrap;
    }

    .logo {
        font-size: 1.5rem;
    }

    .logo img {
        height: 36px;
    }

    .menu-toggle {
        display: none;
        /* 平板以上隱藏漢堡選單 */
    }

    .nav-links {
        display: flex;
        /* 恢復水平排列 */
        flex-direction: row;
        width: auto;
        background: none;
        box-shadow: none;
        margin-top: 0;
        padding: 0;
    }

    .nav-links a {
        font-size: 1rem;
    }

    /* 調整間距與排版 */
    .section {
        padding: 4rem 5%;
    }

    .section-title {
        font-size: 2rem;
        margin-bottom: 3rem;
    }

    .hero {
        padding-top: 60px;
    }

    .hero-content h1 {
        font-size: 3rem;
    }

    .hero-content p {
        font-size: 1.1rem;
    }

    .timeline {
        margin-left: 20px;
        padding-left: 30px;
    }

    .timeline-item::before {
        left: -35px;
        top: 6px;
    }

    .grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 2rem;
    }

    .project-img {
        height: 200px;
    }

    .contact-form {
        padding: 3rem;
        max-width: 600px;
        /* 限制最大寬度避免過長 */
    }

    .project-detail-hero {
        padding: 150px 5% 5rem 5%;
        background-attachment: fixed;
        /* 平板以上加入微捲視差 */
    }

    .project-detail-hero .badge {
        font-size: 0.9rem;
    }

    .project-detail-content {
        max-width: 800px;
        margin: 0 auto;
        padding: 3rem 5%;
    }

    .project-detail-content h3 {
        font-size: 1.5rem;
    }

    .project-detail-content p,
    .project-detail-content ul {
        font-size: 1.1rem;
    }
}

/* =========================================
   響應式設計：Desktop (Min-width: 1200px)
   ========================================= */
@media (min-width: 1200px) {

    /* 進一步放大層級與間距 */
    h1 {
        font-size: 3.2rem;
    }

    .section {
        padding: 5rem 5%;
    }

    .section-title {
        font-size: 2.2rem;
        margin-bottom: 3.5rem;
    }

    .hero-content h1 {
        font-size: 3.5rem;
    }

    .hero-content p {
        font-size: 1.15rem;
    }

    .grid {
        gap: 2.5rem;
    }
}