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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    overflow: hidden; /* ✅ 改成 hidden */
    scrollbar-width: none;
    -ms-overflow-style: none;
    height: 100vh; /* ✅ 加上這行 */
}

body::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* =====================================固定導航欄================================ */
@keyframes navSlideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    animation: navSlideDown 0.6s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.logo {
    color: #333;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.logo:hover {
    color: #ff6b35;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
    position: relative;
}

.nav-links a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    font-size: 1rem;
    transition: color 0.3s ease;
    padding: 0.5rem 1.2rem;
    border-radius: 25px;
    position: relative;
    z-index: 2;
}

.nav-links a.active {
    color: white;
}

.nav-indicator {
    position: absolute;
    background-color: #ff6b35;
    border-radius: 25px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border: 2px solid #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.theme-toggle:hover {
    border-color: #ff6b35;
    color: #ff6b35;
}

/* ======================================頁面容器========================= */
.page {
    position: fixed;
    top: 0px;
    left: 0; /* ✅ 加上這行 */
    right: 0; /* ✅ 加上這行 */
    bottom: 0; /* ✅ 加上這行 */
    display: none;
    overflow-x: hidden;
    overflow-y: auto; /* 保持 auto */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.page::-webkit-scrollbar {
    display: none;
}

.page.active {
    display: block;
}


/* =========================================首頁樣式============================ */
.home-page {
    padding: 4rem 2rem;
    overflow: hidden;
    display: flex; /* ✅ 加上這行 */
    align-items: center; /* ✅ 加上這行 */
    justify-content: center; /* ✅ 加上這行 */
}

.hero-section {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.profile-image-container {
    width: 320px;
    height: 320px;
    margin: 0 auto 3rem;
}

.profile-image {
  width: 100%;
  height: 100%;
  position: relative;
    overflow: hidden;   /* 確保頭不會被切 */

}


.profile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  backface-visibility: hidden; /* 背面隱藏 */
  border-radius: 50%; /* 保持圓形外觀 */
}


.greeting {
    font-size: 2.5rem;
    font-weight: 700;
    margin-top: 3rem;
    color: #333;
}

.name-highlight {
    color: #ff6b35;
}

.description {
    font-size: 1.1rem;
    color: #666;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    line-height: 1.6;
    white-space: nowrap;           /* ✅ 讓文字不自動換行 */
    display: inline-block;         /* ✅ 讓文字居中時保持一行 */
    text-align: center;
}

.tags {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: nowrap;   /* ✅ 不換行 */
    white-space: nowrap; /* ✅ 保持同一行 */
}


.tag {
    font-size: 14px;
    background-color: white;
    border: 2px solid #ddd;
    padding: 0.7rem 1rem;
    border-radius: 25px;
    font-weight: 500;
    color: #333;
}

/* 底部向下按鈕 */
.scroll-down-btn {
  position: absolute;
  left: 50%;
  bottom: 60px;                  /* 與底部距離 */
  transform: translateX(-50%);
  cursor: pointer;
  background-color: #ff6b35;
  border: none;
  border-radius: 50%;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  z-index: 10;
}

.scroll-down-btn:hover {
  transform: translateX(-50%) translateY(5px);
  box-shadow: 0 8px 25px rgba(255, 107, 53, 0.5);
}



/* ======================================About 頁面樣式=================================== */
.about-page {
    margin: 0 auto;
}

.about-content {
    display: flex;
    align-items: center;
    gap: 3rem;
    margin-bottom: 4rem;
    padding-top: 118pt;
    padding-left: 95px;
    padding-bottom: 118px;
    padding-right: 95px;
    background-color: #fff;
    text-align: justify;
}

.about-profile {
    flex: 0 0 300px;
}

.about-profile-image {
    width: 260px;
    height: 310px;
    /* border-radius: 50%; */
    /* overflow: hidden; */
    display: flex;
    align-items: center;
    justify-content: center;
    /* background-color: #ffffff; */
    /* box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1); */
    flex-shrink: 0;
}

.about-profile-image img.about-img {
    width: 100%;                     /* ✅ 圖片縮小到圓形內部 */
    height: auto;
    object-fit: contain;            /* ✅ 保持比例不裁切 */
    /* border-radius: 50%; */
    transform: translateY(10px);    /* ✅ 稍微下移，讓頭部更置中 */
}



.about-info {
    flex: 1;
}

.about-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.about-title h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
}

.about-tags {
    display: flex;
    gap: 0.6rem;
}

.about-tag {
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 20px;
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
}

.about-description,
.about-background {
    font-size: 0.95rem;
    line-height: 1.8;
    color: #444;
    margin-bottom: 1.2rem;
}
/* ====================================教育和工作經驗=================================== */

.experience-section {
    display: flex;
    gap: 2rem;
    padding-left: 95px;
    padding-bottom: 50px; /* 減少底部 padding 為 ADVANTAGES 留空間 */
    padding-right: 95px;
}

.education-block,
.work-block {
    flex: 1;
    padding: 2rem;
}

/* 區塊標題 */
.block-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

/* 項目設計 */
.experience-item {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
}

.experience-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.experience-content {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.experience-info {
    flex: 1;
}

.experience-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.3rem;
}

.experience-subtitle {
    font-size: 0.9rem;
    color: #666;
    padding-top: 2px;
}

.experience-type {
    display: inline-block;
    font-size: 0.85rem;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 0.2rem 0.6rem;
    margin-left: 0.6rem;
    color: #666;
}

/* 修正 EDUCATION 區塊中橘點位置，使其與 WORK 對齊 */
.education-block .work-dot {
    width: 14px;
    height: 14px;
    background-color: #ff6b35;
    border-radius: 50%;
    margin-right: 1px;
    flex-shrink: 0;
    position: relative;
    top: 15px; /* ↓ 調整垂直對齊 */
}

/* ====================================Work 區塊樣式=================================== */

.work-item {
    margin-bottom: 1.5rem;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.work-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    min-height: 80px;
}

.work-header-left {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.work-dot {
    width: 14px;
    height: 14px;
    background-color: #ff6b35;
    border-radius: 50%;
    margin-right: 16px;
    flex-shrink: 0;
}

.work-info {
    flex: 1;
    min-width: 0;
}

.work-company {
    font-size: 1rem;
    font-weight: 600;
    color: #111;
    margin-bottom: 4px;
    line-height: 1.4;
    word-break: break-word;
}

.work-role {
    font-size: 0.875rem;
    color: #666;
    line-height: 1.3;
    word-break: break-word;
}

.work-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.work-period {
    font-size: 0.9rem;
    color: #999;
    background: #f5f5f5;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
}

.dropdown-arrow {
    color: #ff6b35;
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.dropdown-arrow.open {
    transform: rotate(180deg);
}

/* =============================下拉展開內容============================= */
.work-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.work-details.open {
    max-height: 500px;
    padding: 0 24px 24px 54px;
}

.work-details p {
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.work-details strong {
    color: #ff6b35;
    font-weight: 600;
}

.work-details ul {
    margin: 0;
    padding-left: 16px;
}

.work-details li {
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
}
/* ====================================學術與競賽經歷=================================== */

.academic-section {
    background: #ffffff;
    padding: 5rem 6rem;
}

/* 整體列表容器 */
.ac-list {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

/* 每個類別群組 */
.ac-group {
    display: flex;
    gap: 0;
}

/* 左欄：類別標籤 */
.ac-group-label {
    width: 108px;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 600;
    color: #888;
    letter-spacing: 0.04em;
    padding-top: 3px;
    text-align: right;
    padding-right: 20px;
}

/* 右欄：timeline + 內容 */
.ac-group-entries {
    flex: 1;
    border-left: 2px solid #e8e8e8;
    padding-left: 24px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* 單筆記錄 */
.ac-entry {
    display: flex;
    gap: 0;
    padding-bottom: 28px;
    position: relative;
}

.ac-entry:last-child {
    padding-bottom: 0;
}

/* Timeline dot */
.ac-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff6b35;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px #ff6b35;
    flex-shrink: 0;
    margin-top: 4px;
    margin-left: -30px;
    margin-right: 18px;
    position: relative;
    z-index: 1;
}

/* 右側內容 */
.ac-detail {
    flex: 1;
}

/* 上方一行：名稱 + tag + 地點 */
.ac-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.ac-meta-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* 研討會名稱 */
.ac-name {
    font-size: 15px;
    font-weight: 700;
    color: #1A1A2E;
}

/* 類別 tag */
.ac-tag {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 999px;
    padding: 2px 9px;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.ac-tag-zh {
    color: #555;
    background: #f5f5f5;
    border-color: #ddd;
}

/* 地點 */
.ac-location {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #999;
    white-space: nowrap;
}

/* 論文標題 */
.ac-paper {
    font-size: 13.5px;
    color: #555;
    line-height: 1.7;
    margin: 0 0 8px;
}

/* 發表圖片區 */
.ac-photos {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.ac-photo {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 8px;
    background: #f0f0f0;
    display: block;
}

/* src 為空時顯示淡灰佔位框 */
.ac-photo:not([src]), .ac-photo[src=""] {
    border: 1.5px dashed #d0d0d0;
    background: #f8f8f8;
}

@media (max-width: 600px) {
    .ac-photos { grid-template-columns: 1fr; }
}

/* 查看論文按鈕 */
.ac-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #ff6b35;
    text-decoration: none;
    border: 1.5px solid #ff6b35;
    border-radius: 999px;
    padding: 3px 12px;
    transition: background 0.18s, color 0.18s;
}

.ac-link:hover {
    background: #ff6b35;
    color: #fff;
}

/* RWD */
@media (max-width: 1024px) {
    .academic-section { padding: 4rem 3rem; }
}

@media (max-width: 768px) {
    .academic-section { padding: 3rem 1.5rem; }
    .academic-heading { font-size: 1.25rem; margin-bottom: 2rem; }
    .ac-group-label { width: 70px; font-size: 11px; padding-right: 12px; }
    .ac-group-entries { padding-left: 16px; }
    .ac-dot { margin-left: -22px; margin-right: 12px; border-color: #ffffff; }
    .ac-meta { flex-direction: column; align-items: flex-start; gap: 4px; }
    .ac-location { margin-top: 2px; }
}

/* ====================================ADVANTAGES 區域樣式=================================== */


.advantages-section {
    background-color: #ffffff;
    padding: 6rem;
    margin: 0;
}

.advantages-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #333;
    text-align: center;
    margin-bottom: 4rem;
    text-transform: uppercase;
}

.advantages-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
    max-width: 1400px;
    margin: 0 auto;
}

.advantage-item {
    background: #f6f6f6;
    border-radius: 20px;
    padding: 2.5rem;
    text-align: center;
    /* box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.advantage-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
}

.advantage-icon {
    width: 80px;
    height: 80px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    color: #ff6b35;
}

.advantage-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.advantage-description {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.6;
    text-align: justify;
    flex: 1;
}

/* ====================================互動標籤區==================================== */

        .physics-about-section {
            background-color: #f0f0f0;
            padding: 4rem 2rem;
            min-height: 80vh;
            position: relative;
            overflow: hidden;
        }

        .physics-about-header {
            text-align: center;
            margin-bottom: 3rem;
        }

        .physics-about-title {
            font-size: 1.75rem;
            font-weight: 700;
            color: #333;
            margin-bottom: 1rem;
            text-transform: uppercase;
        }

        .physics-about-subtitle {
            font-size: 1rem;
            color: #666;
            margin-bottom: 2rem;
        }

        .ux-dna-underline {
            text-decoration: underline;
            text-decoration-thickness: 2px;
            text-underline-offset: 4px;
        }

        .legend {
            display: flex;
            flex-direction: column;
            gap: 0.8rem;
            position: absolute;
            left: 2rem;
            top: 12rem;
            z-index: 10;
        }

        .legend-item {
            display: flex;
            align-items: center;
            gap: 0.8rem;
            font-size: 0.9rem;
            font-weight: 500;
        }

        .legend-dot {
            width: 14px;
            height: 14px;
            border-radius: 50%;
        }

        .legend-dot.tools {
         border: 2px solid #333;
        background-color: #ff6b35;
        }

        .legend-dot.traits {
            background-color: #dadada;
            border: 2px solid #333;
        }

        .legend-dot.methods {
            background-color: #fff;
            border: 2px solid #333;
        }

        #physics-canvas {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 5;
        }

        .physics-tag {
            position: absolute;
            padding: 0.6rem 1.2rem;
            border-radius: 25px;
            font-weight: 500;
            font-size: 1.5rem;
            cursor: grab;
            user-select: none;
            transition: transform 0.1s ease;
            white-space: nowrap;
            z-index: 6;
        }

        .physics-tag:active {
            cursor: grabbing;
            transform: scale(1.05);
        }

        .physics-tag.tools {
         border: 2px solid #333;
        background-color: #ff6b35;
            color: white;
        }

        .physics-tag.traits {
            background-color: #dadada;
            border: 2px solid #333;
            color: #333;
        }

        .physics-tag.methods {
            background-color: white;
            color: #333;
            border: 2px solid #333;
        }








/* ====================================Projects 頁面樣式==================================== */
.projects-page {
    background-color: #f5f5f5;
}

/* 左右分欄佈局 */
.projects-layout {
    display: flex;
    min-height: 100vh;
    padding-top: 60px;
}

/* 左側篩選器 */
.projects-sidebar {
    width: 220px;
    flex-shrink: 0;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
    scrollbar-width: none;
    background-color: #ffffff;
    border-right: 1px solid #ebebeb;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
}

.projects-sidebar::-webkit-scrollbar {
    display: none;
}

.projects-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    text-transform: uppercase;
    margin-bottom: 0.4rem;
}

.project-count {
    font-size: 0.85rem;
    color: #ff6b35;
    font-weight: 700;
    margin-bottom: 1rem;
}

.projects-subtitle {
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #ebebeb;
}

/* 篩選清單（垂直） */
.filter-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-btn {
    background: transparent;
    border: none;
    border-radius: 10px;
    padding: 0.55rem 0.9rem;
    text-align: left;
    cursor: pointer;
    font-size: 0.875rem;
    color: #555;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease;
    font-family: inherit;
}

.filter-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.filter-btn.active {
    background-color: #ff6b35;
    color: white;
    font-weight: 600;
}

/* 右側作品區 */
.projects-main {
    flex: 1;
    min-width: 0;
    padding: 2rem 2.5rem 4rem;
}

/* 專案網格 */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.project-link {
  text-decoration: none;
  color: inherit;
  display: block;
}
/* ====================================專案卡片==================================== */

.project-card {
    background-color: white;
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative; /* 🔑 讓 badge 可定位 */

}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.project-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background-color: rgba(159, 159, 159, 0.3); /* 半透明橘底 */
  color: #fff; /* 白色文字 */
  font-size: 1rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  border: 1.5px solid #ffffff; /* 橘色邊框 */
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  z-index: 2;
  text-transform: uppercase;
  backdrop-filter: blur(2px); /* 增添玻璃感，可省略 */
}

.project-image {
    width: 100%;
    height: 300px;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* ⭐ 核心：保持比例裁切填滿 */
  display: block;
}

.project-placeholder {
    color: #999;
    font-size: 1rem;
}

.project-info {
    padding: 1.5rem;
}

.project-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.project-description {
    color: #666;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* 專案標籤 */
.project-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.project-tag {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #6c757d;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* 隱藏被篩選的項目 */
.project-card.hidden {
    display: none;
}

/* ============================================= */
/* 🔧 修正首頁動畫期間「擠在一起」的問題           */
/* ============================================= */

/* 讓動畫的頁面完全獨立定位，避免被 flex 壓縮 */
.slide-up-out,
.slide-up-in,
.slide-down-out,
.slide-down-in {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 0;
  background: inherit;         /* 保留原頁面背景 */
  overflow: hidden;
  display: block !important;   /* 確保動畫期間仍顯示 */
  z-index: 999;                /* 疊在其他元素之上 */
}

/* 確保首頁和 about 的內容不被動畫影響到 layout */
.home-page,
.about-page {
  transform: none;
  transition: none;
}




/* ＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝動畫效果＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝ */

/* 頁面滑動動畫 */
@keyframes slideUpOut {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-100%); opacity: 0; }
}

@keyframes slideUpIn {
  0% { transform: translateY(100%); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.slide-up-out {
  animation: slideUpOut 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  position: relative;
  z-index: 5;
  will-change: transform;
}

.slide-up-in {
  animation: slideUpIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  position: relative;
  z-index: 6;
  will-change: transform;
}

@keyframes slideDownOut {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(100%); opacity: 0; }
}

@keyframes slideDownIn {
  0% { transform: translateY(-100%); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.slide-down-out {
  animation: slideDownOut 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  position: relative;
  z-index: 5;
  will-change: transform;
}

.slide-down-in {
  animation: slideDownIn 0.6s cubic-bezier(0, 0, 0.2, 1) forwards;
  position: relative;
  z-index: 6;
  will-change: transform;
}




/* ====================================手機版置底篩選 nav（body 層級）==================================== */
.mobile-filter-nav {
    display: none; /* JS 加上 .visible 才出現 */
    position: fixed;
    bottom: 16px;
    left: 12px;
    right: 12px;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.14), 0 1px 4px rgba(0, 0, 0, 0.06);
    border: 1px solid #e1e1e1;
    padding: 0.75rem 1rem;
    z-index: 300;
}

.mobile-filter-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.4rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    justify-content: center;
}

.mobile-filter-list::-webkit-scrollbar {
    display: none;
}

/* 只在手機尺寸才允許顯示 */
@media (max-width: 768px) {
    .mobile-filter-nav.visible {
        display: block;
    }

    .mobile-filter-nav .filter-btn {
        padding: 0.4rem 0.9rem;
        font-size: 0.8rem;
        border-radius: 20px;
        border: 1.5px solid #ddd;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .mobile-filter-nav .filter-btn.active {
        background-color: #ff6b35;
        border-color: #ff6b35;
        color: white;
    }
}

/* 響應式設計 - ADVANTAGES */
@media (max-width: 1024px) {
    .advantages-section {
        padding: 4rem 3rem;
    }
    
    .advantages-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2.5rem;
    }
    
    .advantage-item {
        padding: 2rem;
        min-height: 280px;
    }
    
    .advantages-title {
        font-size: 1.6rem;
        margin-bottom: 3rem;
    }
    
    /* 確保平板版本下拉選單箭頭保持在右側 */
    .work-header {
        flex-wrap: nowrap;
        align-items: center;
    }
    
    .work-header-left {
        flex: 1;
        min-width: 0;
    }
    
    .work-header-right {
        flex-shrink: 0;
        margin-left: 1rem;
    }
    /*互動標籤 */
               .physics-tag {
                transform: scale(0.8);
                font-size: 1.5rem;
                padding: 0.5rem 1rem;
            }
            
            .legend {
                left: 1.5rem;
                top: 10rem;
            }
            
            .physics-about-section {
                padding: 3rem 1.5rem;
            }
        }

/* ====================================響應式設計 - 通用==================================== */

@media (max-width: 1200px) {
    .projects-sidebar {
        width: 190px;
        padding: 1.75rem 1.25rem;
    }
    .projects-main {
        padding: 1.75rem 2rem 3rem;
    }
}

@media (max-width: 968px) {
    .about-content {
        flex-direction: column;
        gap: 2rem;
        text-align: justify;
        padding-left: 2rem;
        padding-right: 2rem;
    }

    .about-profile {
        flex: none;
        align-self: center;
    }

    .about-profile-image {
        width: 250px;
        height: 250px;
    }

    .experience-section {
        flex-direction: column;
        gap: 2rem;
        padding-left: 2rem;
        padding-right: 2rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .projects-sidebar {
        width: 170px;
        padding: 1.5rem 1rem;
    }

    .projects-main {
        padding: 1.5rem 1.5rem 3rem;
    }
    
    .advantages-section {
        padding: 3rem 2rem;
    }
    
    .advantages-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .advantage-item {
        padding: 1.5rem;
        min-height: 250px;
    }
    
    .advantages-title {
        font-size: 1.5rem;
        margin-bottom: 2.5rem;
    }
    
    .advantage-icon {
        width: 70px;
        height: 70px;
        margin-bottom: 1rem;
    }
    
    .advantage-title {
        font-size: 1.1rem;
    }
    
    .advantage-description {
        font-size: 0.95rem;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }

    .logo {
        font-size: 0.85rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .nav-links a {
        font-size: 0.9rem;
        padding: 0.4rem 1rem;
    }

    .about-content {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .about-profile-image {
        width: 200px;
        height: 200px;
    }

    .about-title h1 {
        font-size: 1.8rem;
    }

    .about-tags {
        justify-content: center;
        flex-wrap: wrap;
    }

    .education-block,
    .work-block {
        padding: 1.5rem;
    }

    .experience-section {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    
    /* 手機版本保持一行顯示 */
    .work-header {
        flex-wrap: nowrap;
        padding: 20px 16px;
        min-height: 70px;
    }
    
    .work-company {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: calc(100vw - 120px);
    }
    
    .work-role {
        font-size: 0.85rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .work-header-right {
        margin-left: 0.5rem;
    }
    
    .work-details.open {
        padding: 0 20px 20px 36px;
    }

    /* 手機版：sidebar 隱藏，改用 body 層級的 .mobile-filter-nav */
    .projects-layout {
        flex-direction: column;
        padding-top: 56px;
    }

    .projects-sidebar {
        display: none;
    }

    .projects-main {
        padding: 1.25rem 1.25rem 110px;
    }

    .project-image {
        height: 250px;
    }
                .physics-tag {
                transform: scale(0.6);
                font-size: 1.5rem;
                padding: 0.4rem 0.8rem;
            }
            
            .legend {
                left: 1rem;
                top: 8rem;
            }
            
            .legend-item {
                font-size: 1rem;
                gap: 0.6rem;
            }
            
            .legend-dot {
                width: 12px;
                height: 12px;
            }
            
            .physics-about-section {
                padding: 2rem 1rem;
            }
            
            .physics-about-title {
                font-size: 2rem;
            }
            
            .physics-about-subtitle {
                font-size: 1rem;
            }
}

@media (max-width: 480px) {
    .logo {
        font-size: 0.78rem;
    }

    .nav-links a {
        font-size: 0.8rem;
        padding: 0.3rem 0.8rem;
    }

    .theme-toggle {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }

    .about-content {
        gap: 1.5rem;
        padding-left: 1rem;
        padding-right: 1rem;
        padding-top: 3rem;
        padding-bottom: 3rem;
    }

    .about-profile-image {
        width: 180px;
        height: 180px;
    }



    .about-title {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .about-title h1 {
        font-size: 1.6rem;
    }

    .experience-section {
        padding-left: 1rem;
        padding-right: 1rem;
        padding-bottom: 2rem;
    }
    
    .work-header {
        padding: 16px 12px;
        min-height: 60px;
    }
    
    .work-company {
        max-width: calc(100vw - 100px);
        font-size: 0.9rem;
    }
    
    .work-role {
        font-size: 0.8rem;
    }
    
    .dropdown-arrow {
        width: 20px;
        height: 20px;
    }
    
    .work-dot {
        width: 12px;
        height: 12px;
        margin-right: 12px;
    }
    
    .work-period {
        font-size: 0.8rem;
        padding: 0.2rem 0.6rem;
    }
    
    .work-details.open {
        padding: 0 16px 16px 32px;
    }
    
    .work-details li {
        font-size: 0.85rem;
    }

    .projects-sidebar {
        display: none;
    }

    .projects-title {
        font-size: 1.1rem;
    }

    .projects-main {
        padding: 1rem 1rem 2.5rem;
    }

    .project-info {
        padding: 1rem;
    }
    
    .advantages-section {
        padding: 2rem 1rem;
    }
    
    .advantage-item {
        padding: 1.25rem;
        min-height: 220px;
    }
    
    .advantages-title {
        font-size: 1.6rem;
        margin-bottom: 2rem;
    }
    
    .advantage-icon {
        width: 60px;
        height: 60px;
    }
    
    .advantage-title {
        font-size: 1rem;
    }
    
    .advantage-description {
        font-size: 0.9rem;
    }
                .physics-tag {
                transform: scale(0.5);
                font-size: 0.75rem;
                padding: 0.3rem 0.6rem;
            }
            
            .legend {
                left: 0.5rem;
                top: 7rem;
            }
            
            .physics-about-title {
                font-size: 1.8rem;
            }
}

/* ====================================手機版靜態標籤==================================== */
@media (max-width: 768px) {
    /* 隱藏 canvas（手機版不用物理引擎） */
    #physics-canvas {
        display: none;
    }

    .static-tags-wrapper {
        display: flex;
        flex-wrap: wrap;
        gap: 0.6rem;
        justify-content: center;
        padding: 1rem 0.5rem 2rem;
        position: relative;
        z-index: 6;
    }

    /* 手機版 physics-tag 恢復正常尺寸（不做 transform scale） */
    .static-tags-wrapper .physics-tag {
        position: static;
        transform: none !important;
        font-size: 0.9rem;
        padding: 0.45rem 1rem;
    }
}