/* ===================================
   響應式網頁設計 (RWD) 通用樣式
   ================================== */

/* 確保圖片和媒體元素響應式 */
img,
video,
iframe {
    max-width: 100%;
    height: auto;
}

/* 防止水平滾動 */
body {
    overflow-x: hidden;
}

/* 觸控友善的按鈕和連結 */
@media (hover: none) and (pointer: coarse) {
    a,
    button,
    .nav-link,
    .carousel-controls {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* 平板優化 (1024px 以下) */
@media (max-width: 1024px) {
    /* 調整字體大小 */
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.3rem; }
    h4 { font-size: 1.1rem; }
    
    /* 調整間距 */
    section {
        padding: 30px 0;
    }
}

/* 手機優化 (768px 以下) */
@media (max-width: 768px) {
    /* 調整字體大小 */
    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.4rem; }
    h3 { font-size: 1.2rem; }
    h4 { font-size: 1rem; }
    
    /* 調整間距 */
    section {
        padding: 24px 0;
    }
    
    /* 確保表格可以水平滾動 */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* 小型手機優化 (480px 以下) */
@media (max-width: 480px) {
    /* 調整字體大小 */
    body {
        font-size: 14px;
    }
    
    h1 { font-size: 1.4rem; }
    h2 { font-size: 1.2rem; }
    h3 { font-size: 1.1rem; }
    h4 { font-size: 1rem; }
    
    /* 調整間距 */
    section {
        padding: 20px 0;
    }
}

/* 橫向模式優化 */
@media (max-width: 768px) and (orientation: landscape) {
    #poster {
        height: 70vh;
    }
    
    .header {
        min-height: 80px;
    }
}

/* 高解析度螢幕優化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* 確保圖片和圖標清晰 */
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* 無障礙優化 - 大字體模式 */
@media (prefers-reduced-motion: no-preference) {
    * {
        scroll-behavior: smooth;
    }
}

/* 打印樣式 */
@media print {
    /* 隱藏不必要的元素 */
    .header__nav,
    .carousel-controls,
    .psc-floater,
    footer {
        display: none !important;
    }
    
    /* 確保內容適合打印 */
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    /* 避免分頁問題 */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }
    
    img {
        max-width: 100%;
        page-break-inside: avoid;
    }
}

/* 超寬螢幕優化 (1920px 以上) */
@media (min-width: 1920px) {
    .container {
        max-width: 1800px;
    }
}

/* 極小螢幕優化 (320px 以下) */
@media (max-width: 320px) {
    body {
        font-size: 13px;
    }
    
    .container {
        width: 100%;
        padding-inline: 6px;
    }
    
    h1 { font-size: 1.2rem; }
    h2 { font-size: 1.1rem; }
    h3 { font-size: 1rem; }
}
