/* 重置和基礎樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    line-height: 1.6;
    color: #333;
    overflow-x: hidden;
}

/* 頁面背景色 */
html { background: #000; }

/* 載入期間禁止滾動 */
html.no-scroll,
body.no-scroll {
    overflow: hidden;
    height: 100%;
}
html.no-scroll { overscroll-behavior: none; }
body.no-scroll { position: fixed; width: 100%; }

.page-preloader {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000 url('images/Loading_background.png') center / cover no-repeat;
    z-index: 4000;
    transition: opacity 0.4s ease;
    pointer-events: auto;
}

.page-preloader::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 0;
}

.page-preloader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 32px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    text-align: center;
    font-weight: 500;
    letter-spacing: 0.08em;
    backdrop-filter: blur(6px);
    z-index: 1;
}

.preloader-spinner {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    animation: preloaderSpin 1s linear infinite;
}

.preloader-text {
    font-size: 1rem;
}

@keyframes preloaderSpin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .preloader-spinner {
        animation: none;
        border-top-color: rgba(255, 255, 255, 0.75);
    }
}

:root {
    --navbar-opacity: 0.95; /* 直接在這裡調整 0.50 ~ 1.00 */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 導航欄 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, var(--navbar-opacity));
    backdrop-filter: blur(10px);
    z-index: 1000;
    padding: 1rem 0;
    transition: all 0.3s ease;
}

.navbar.scrolled {
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo h2 {
    color: #2c3e50;
    font-weight: 700;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-logo-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    display: block;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: #2c3e50;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: #3498db;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: #3498db;
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.bar {
    width: 25px;
    height: 3px;
    background: #2c3e50;
    margin: 3px 0;
    transition: 0.3s;
}

/* 首頁區塊 */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    color: white;
    padding: 0 20px;
    position: relative;
    overflow: hidden;
}

/* 影片背景 */
.hero-video-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0; /* 調整：確保不會被頁面背景覆蓋 */
    background-image: url('images/Loading_background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.hero-video-background video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* 影片淡入顯示 */
.video-autoplay { opacity: 0; transition: opacity 300ms ease; }
.video-autoplay.is-playing { opacity: 1; }

/* 手機端：hero 影片直接顯示，不需要等待播放狀態 */
@media (max-width: 768px) {
    #hero-bg-video.video-autoplay { 
        opacity: 1 !important; 
        transition: none;
    }
    
}

.hero-video-background img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* 影片遮罩層 */
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 改為僅底部加深，避免整體偏灰 */
    background: linear-gradient(transparent 55%, rgba(0, 0, 0, 0.45) 100%);
    z-index: 0; /* 調整：位於影片之上、內容之下 */
}

.hero-content {
    flex: 1;
    max-width: 600px;
    position: relative;
    z-index: 2; /* 調整：確保內容在最上層 */
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    animation: fadeInUp 1s ease;
}

.hero-subtitle {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
    animation: fadeInUp 1s ease 0.2s both;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    animation: fadeInUp 1s ease 0.4s both;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    display: inline-block;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.btn-secondary:hover {
    background: white;
    color: #667eea;
    transform: translateY(-2px);
}

/* 通用圖片佔位符樣式 */
.image-placeholder {
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 3rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.image-placeholder p {
    font-size: 1rem;
    margin-top: 1rem;
    opacity: 0.8;
}

/* 區塊標題 */
.section-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    color: #2c3e50;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: #3498db;
}

/* 作品集區塊 */
.portfolio {
    padding: 100px 0;
    background: #f8f9fa;
}

.portfolio-filters {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 20px;
    border: 2px solid #3498db;
    background: transparent;
    color: #3498db;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.filter-btn.active,
.filter-btn:hover {
    background: #3498db;
    color: white;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.portfolio-item {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.portfolio-item:hover {
    transform: translateY(-10px);
}

.portfolio-image {
    height: 250px;
    overflow: hidden;
}

.portfolio-image .image-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 0;
    background: linear-gradient(45deg, #667eea, #764ba2);
}

/* 短影音沿用一般比例（取消直式） */

/* 作品圖片填滿容器 */
.portfolio-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 移除未使用的縮圖載入動畫樣式 */

.portfolio-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 2rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.portfolio-item:hover .portfolio-overlay {
    transform: translateY(0);
}

.portfolio-overlay h3 {
    margin-bottom: 0.5rem;
}

/* 影片播放徽章 */
.play-badge {
    position: absolute;
    right: 16px;
    bottom: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0,0,0,0.55);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
}

.play-badge i {
    margin-left: 2px;
}

/* 影音燈箱 */
.video-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 24px;
}

.video-lightbox.active {
    display: flex;
}

.video-wrapper {
    width: min(100%, 960px);
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.video-wrapper iframe,
.video-wrapper video {
    width: 100%;
    height: 100%;
    display: block;
}

.video-close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* 相片燈箱 */
.image-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 24px;
}

.image-lightbox.active { display: flex; }

.image-modal {
    position: relative;
    width: min(100%, 1040px);
    max-height: 85vh;
    overflow: hidden;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    padding: 24px 24px 16px;
    display: flex;
    flex-direction: column;
}

.image-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: #6b441e;
    margin-bottom: 12px;
}

.image-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0,0,0,0.06);
    color: #333;
    border: 1px solid rgba(0,0,0,0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.image-gallery {
    overflow: auto;
    padding: 6px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    flex: 1;
    min-height: 0; /* 關鍵：允許在彈性容器內正確計算可滾動高度 */
}

.image-gallery img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    border-radius: 10px;
    display: block;
    background: #f3f3f3;
}

@media (max-width: 768px) {
    /* 盡可能隱藏行動端原生控制與播放按鈕（不同廠商實作差異大，盡量壓制） */
    video::-webkit-media-controls,
    video::-webkit-media-controls-panel,
    video::-webkit-media-controls-play-button,
    video::-webkit-media-controls-volume-slider,
    video::-webkit-media-controls-mute-button,
    video::-webkit-media-controls-timeline,
    video::-webkit-media-controls-current-time-display,
    video::-webkit-media-controls-time-remaining-display,
    video::-webkit-media-controls-fullscreen-button,
    video::-webkit-media-controls-enclosure,
    video::-webkit-media-controls-overlay-play-button,
    video::-webkit-media-controls-start-playback-button {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        -webkit-appearance: none !important;
    }
    /* 隱藏行動裝置預設影片播放控制與中心播放圖示（確保初始無播放圖樣） */
    video::-webkit-media-controls {
        display: none !important;
        opacity: 0 !important;
    }
    video::-webkit-media-controls-start-playback-button {
        display: none !important;
        -webkit-appearance: none;
        opacity: 0 !important;
    }
    video::-webkit-media-controls-enclosure {
        display: none !important;
        opacity: 0 !important;
    }
    .image-modal { width: min(100%, 760px); }
    .image-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .image-gallery img { height: 180px; }
}

@media (max-width: 480px) {
    .image-modal { width: 100%; }
    .image-gallery { grid-template-columns: 1fr; }
    .image-gallery img { height: 200px; }
}

/* 關於我區塊 */
.about {
    padding: 100px 0;
    background: white;
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.about-text p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.8;
}

.skills {
    margin-top: 2rem;
}

.skills h3 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
    font-size: 1.4rem;
    font-weight: 600;
}

.skills-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
}

.skills-list li {
    background: #f8f9fa;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    color: #2c3e50;
    border-left: 4px solid #3498db;
    transition: all 0.3s ease;
    position: relative;
}

.skills-list li:hover {
    background: #e3f2fd;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

.skills-list li::before {
    content: '✓';
    color: #3498db;
    font-weight: bold;
    margin-right: 0.5rem;
}

.about-image .image-placeholder {
    width: 100%;
    height: 400px;
    background: linear-gradient(45deg, #3498db, #2980b9);
}

/* 關於我圖片樣式：滿版寬度保持原始比例 */
.about-image {
    position: relative;
    width: 100%;
    margin: 0 auto;
    max-width: 520px;
    justify-self: center;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.45), rgba(44, 62, 80, 0.35), rgba(52, 152, 219, 0.15));
    padding: 10px;
    box-shadow:
        0 18px 55px rgba(0, 0, 0, 0.18),
        0 8px 18px rgba(0, 0, 0, 0.10);
    transition: transform 220ms ease, box-shadow 220ms ease;
}

.about-image img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    object-position: 41% 25%;
    display: block;
    border-radius: 14px;
    background: #111;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
    transform: scale(1.001);
    transition: transform 260ms ease, filter 260ms ease;
    filter: saturate(1.04) contrast(1.03);
}

.about-image:hover {
    transform: translateY(-4px);
    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.22),
        0 10px 22px rgba(0, 0, 0, 0.12);
}

.about-image:hover img {
    transform: scale(1.03);
}

@media (prefers-reduced-motion: reduce) {
    .about-image,
    .about-image img {
        transition: none;
    }

    .about-image:hover {
        transform: none;
    }

    .about-image:hover img {
        transform: none;
    }
}

.about-image .image-placeholder {
    width: 100%;
    height: 400px;
    background: linear-gradient(45deg, #3498db, #2980b9);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
}

/* 部落格區塊 */
.blog {
    padding: 100px 0;
    background: #f8f9fa;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.blog-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.blog-card:hover {
    transform: translateY(-5px);
}

.blog-image {
    height: 200px;
    overflow: hidden;
}

.blog-image .image-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 0;
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    font-size: 2rem;
}

.blog-content {
    padding: 2rem;
}

.blog-content h3 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.blog-date {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.blog-content p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.read-more {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.read-more:hover {
    color: #2980b9;
}

/* 聯絡區塊 */
.contact {
    padding: 100px 0;
    background: white;
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
}

.contact-info h3 {
    margin-bottom: 2rem;
    color: #2c3e50;
}

.contact-item {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
}

.contact-item i {
    font-size: 1.5rem;
    color: #3498db;
    margin-right: 1rem;
    width: 40px;
}

.contact-item h4 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.contact-link {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
    word-break: break-all;
}

.contact-link:hover {
    color: #2980b9;
    text-decoration: underline;
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.social-link {
    width: 50px;
    height: 50px;
    background: #3498db;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-link:hover {
    background: #2980b9;
    transform: translateY(-3px);
}

.contact-form h3 {
    margin-bottom: 2rem;
    color: #2c3e50;
}

.contact-form {
    position: relative; /* 為小卡片定位 */
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #ecf0f1;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

/* 頁腳 */
.footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 2rem 0;
}

/* 動畫 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 移除未使用的感謝頁樣式註解 */

 #thankCard {
    display: none; /* 預設隱藏 */
    position: absolute; /* 相對於表單 */
    top: 50%; 
    left: 50%;
    transform: translate(-50%, -50%);
    background: #d4edda;
    color: #155724;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-weight: 500;
    z-index: 10;
    text-align: center;
}

#thankCard.show {
    animation: fadeIn 0.5s forwards;
}

@keyframes fadeIn {
    from {opacity: 0; transform: translate(-50%, -60%);}
    to {opacity: 1; transform: translate(-50%, -50%);}
}


/* 平面攝影（資料夾式卡片）樣式 */
.portfolio-item.folder {
    box-shadow: none;
    overflow: visible;
}

.folder-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    background: #fff;
}

.folder-thumb {
    position: relative;
    height: 250px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.folder-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.folder-cta {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(255,255,255,0.9);
    color: #5a3a16;
    border: 2px solid rgba(255,255,255,0.95);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: pointer;
    z-index: 2;
}

.folder-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1;
}

.portfolio-item.folder:hover .folder-thumb::after,
.portfolio-item.folder:hover .folder-cta {
    opacity: 1;
}

.folder-title {
    text-align: center;
    padding: 14px 8px 0;
    font-weight: 700;
    color: #5a3a16;
}

.folder-gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 14px;
}

.folder-gallery img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

/* 響應式設計 */
@media (max-width: 768px) {
    /* 導航欄 */
    .hamburger {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: #ffffff; /* 手機展開選單使用不透明背景 */
        backdrop-filter: blur(10px);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.1);
        padding: 2rem 0;
        height: calc(100vh - 70px);
        overflow-y: auto;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-item {
        margin: 1rem 0;
    }

    .nav-link {
        font-size: 1.2rem;
        padding: 1rem 0;
        display: block;
        min-height: 44px; /* 觸控友好的最小高度 */
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* 首頁區塊 */
    .hero {
        flex-direction: column;
        text-align: center;
        padding: 100px 20px 50px;
        min-height: 100vh;
    }
    
    .hero-content {
        max-width: 100%;
        margin-left: 0;
    }

    .hero-title {
        font-size: 2.5rem;
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .btn {
        width: 200px;
        text-align: center;
        min-height: 44px; /* 觸控友好的最小高度 */
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* 作品集區塊 */
    .portfolio {
        padding: 60px 0;
    }

    .portfolio-filters {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem 0.75rem;
        align-items: stretch;
        justify-items: center;
        margin-bottom: 2rem;
    }

    .filter-btn {
        width: 100%;
        margin: 0;
        min-height: 44px; /* 觸控友好的最小高度 */
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1rem;
    }

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

    .portfolio-item {
        margin-bottom: 1rem;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent; /* 移除iOS點擊高亮 */
    }

    .portfolio-image {
        height: 200px;
    }

    .portfolio-overlay {
        padding: 1.5rem;
        transform: translateY(0);
        background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    }

    .portfolio-overlay h3 {
        font-size: 1.1rem;
    }

    .portfolio-overlay p {
        font-size: 0.9rem;
    }

    .folder-gallery {
        grid-template-columns: 1fr 1fr;
    }

    /* 關於我區塊 */
    .about {
        padding: 60px 0;
    }

    .about-content {
        display: block;
        text-align: center;
    }

    .about-image {
        width: 100%;
    }

    .about-image img {
        height: auto;
        object-fit: cover;
    }

    .skills {
        margin-top: 1.5rem;
    }

    .skills-list {
        grid-template-columns: repeat(2, 1fr); /* 手機端改為兩欄，維持元素順序 */
        grid-auto-flow: row;
        gap: 0.6rem;
    }

    .skills-list li {
        padding: 0.7rem 0.9rem;
        font-size: 0.95rem;
    }

    /* 部落格區塊 */
    .blog {
        padding: 60px 0;
    }

    .blog-grid {
        display: block;
    }

    .blog-card {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .blog-content {
        padding: 1.5rem;
    }

    /* 聯絡區塊 */
    .contact {
        padding: 60px 0;
    }

    .contact-content {
        display: block;
    }

    .contact-info {
        text-align: center;
    }

    .contact-item {
        flex-direction: column;
        text-align: center;
        margin-bottom: 1.5rem;
    }

    .contact-item i {
        margin-right: 0;
        margin-bottom: 0.5rem;
        font-size: 2rem;
    }

    .contact-link {
        display: inline-block;
        padding: 8px 0;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        -webkit-tap-highlight-color: transparent;
    }

    .social-links {
        justify-content: center;
        margin-top: 1.5rem;
    }

    .social-link {
        min-width: 50px;
        min-height: 50px;
        -webkit-tap-highlight-color: transparent;
    }

    /* 表單優化 */
    .form-group input,
    .form-group textarea {
        padding: 12px;
        font-size: 16px; /* 防止iOS縮放 */
        min-height: 44px; /* 觸控友好的最小高度 */
    }

    .form-group textarea {
        min-height: 120px;
    }

    .form-group button[type="submit"] {
        min-height: 44px;
        width: 100%;
        font-size: 1rem;
    }

    /* 燈箱優化 */
    .video-lightbox {
        padding: 10px;
    }

    .video-wrapper {
        width: 100%;
        max-width: 100%;
    }

    .video-close {
        top: 10px;
        right: 10px;
        width: 44px;
        height: 44px;
        font-size: 1rem;
        min-height: 44px;
        -webkit-tap-highlight-color: transparent;
    }

    /* 通用樣式調整 */
    .section-title {
        font-size: 2rem;
        margin-bottom: 2rem;
    }

    .container {
        padding: 0 15px;
    }

    /* 觸控優化 */
    * {
        -webkit-tap-highlight-color: transparent;
    }

    /* 改善滾動體驗 */
    html {
        -webkit-overflow-scrolling: touch;
    }

    /* 防止文字選擇 */
    .portfolio-item,
    .blog-card,
    .btn,
    .filter-btn {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }

    /* 改善觸控響應 */
    .portfolio-item,
    .blog-card,
    .filter-btn {
        touch-action: pan-y; /* 允許垂直滾動 */
    }

    /* 防止意外觸發 */
    .portfolio-item:active,
    .blog-card:active,
    .filter-btn:active {
        transform: none;
    }
}

@media (max-width: 480px) {
    /* 更小螢幕的優化 */
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
    }

    .btn {
        width: 180px;
        padding: 10px 20px;
        font-size: 0.9rem;
        min-height: 44px;
    }

    .portfolio-filters {
        gap: 0.25rem 0.5rem;
    }

    .filter-btn {
        width: 100%;
        padding: 8px 16px;
        font-size: 0.9rem;
        min-height: 44px;
    }

    .portfolio-image {
        height: 180px;
    }

    .about-image {
        max-width: 250px;
        padding: 8px;
    }

    .about-image img {
        height: auto;
        object-fit: cover;
    }

    .skills-list li {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }

    .contact-item i {
        font-size: 1.5rem;
    }

    .social-link {
        width: 45px;
        height: 45px;
        font-size: 1rem;
        min-width: 45px;
        min-height: 45px;
    }

    .folder-gallery img {
        height: 140px;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .container {
        padding: 0 10px;
    }

    /* 更緊湊的間距 */
    .portfolio,
    .about,
    .blog,
    .contact {
        padding: 40px 0;
    }

    .portfolio-grid,
    .blog-grid {
        gap: 1rem;
    }
}

/* 平板版優化 */
@media (min-width: 769px) and (max-width: 1024px) {
    .hero-content {
        margin-left: 5vw;
    }

    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .about-content {
        gap: 3rem;
    }

    .about-image {
        width: 100%;
    }

    .about-image img {
        height: auto;
        object-fit: cover;
    }

    .contact-content {
        gap: 3rem;
    }

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

    .section-title {
        font-size: 2.2rem;
    }

    /* 平板版觸控優化 */
    .btn,
    .filter-btn,
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .portfolio-item,
    .blog-card {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        touch-action: pan-y; /* 允許垂直滾動 */
    }

    /* 防止意外觸發 */
    .portfolio-item:active,
    .blog-card:active,
    .filter-btn:active {
        transform: none;
    }
}

/* 桌面版定位：將首頁文字區塊約置於螢幕寬度 1/4 處 */
@media (min-width: 1024px) {
    .hero-content {
        margin-left: 10vw;
    }
}


/* 作品集以下區塊調整為非格狀（單欄直向）佈局 */

.blog-card {
    width: 100%;
    margin-bottom: 2rem;
}

.contact-content > * {
    margin-bottom: 0;
}

.contact-content > *:last-child {
    margin-bottom: 0;
}

/* 桌面版部落格區塊：橫向排列（左到右）、可水平捲動 */
@media (min-width: 769px) {
    .blog-grid {
        display: flex;
        flex-wrap: nowrap;
        gap: 1.5rem;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 8px;
        scroll-snap-type: x mandatory;
    }

    .blog-card {
        flex: 0 0 360px;
        scroll-snap-align: start;
    }
}

/* 桌面版聯絡區塊：左右兩欄 */
@media (min-width: 769px) {
    .contact-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 4rem;
    }
}

/* 移除 LOGO 片頭載入層相關樣式 */
/* Intro overlay for logo video */
.intro-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    display: none; /* default hidden; shown via JS */
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.intro-overlay video {
    width: 100%;
    height: 100%;
    object-fit: cover; /* desktop full-bleed */
    display: block;
    outline: none;
}

.intro-overlay.hide {
    animation: introFadeOut 600ms ease forwards;
}

@keyframes introFadeOut {
    from { opacity: 1; }
    to { opacity: 0; visibility: hidden; }
}

/* Hide intro overlay entirely on small screens */
@media (max-width: 768px) {
    .intro-overlay { display: none !important; }
}