/**
 * Mobile-First SEO 優化樣式
 * 潤曜科技 (LustraTech)
 *
 * 此檔案包含:
 * - 觸控目標優化 (最小 48x48px)
 * - 字體可讀性優化
 * - CLS 防止措施
 * - 行動裝置優先設計
 */

/* ===== Core Web Vitals: CLS Prevention ===== */

/* 為圖片預留空間，防止 CLS */
img {
    max-width: 100%;
    height: auto;
    aspect-ratio: attr(width) / attr(height);
}

/* 為 iframe 預留空間 */
iframe {
    max-width: 100%;
}

/* 字體載入時防止文字閃爍 */
@font-face {
    font-display: swap;
}


/* ===== Mobile Touch Target Optimization ===== */
/* Google 建議: 觸控目標最小 48x48px，間距至少 8px */

/* 所有互動元素最小尺寸 */
a,
button,
input[type="submit"],
input[type="button"],
.btn {
    min-height: 48px;
    min-width: 48px;
    padding: 12px 16px;
}

/* 表單輸入欄位優化 */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="search"],
input[type="url"],
textarea,
select {
    min-height: 48px;
    font-size: 16px; /* 防止 iOS 縮放 */
    padding: 12px;
}

/* 導航連結優化 */
nav a,
.nav-link,
.navbar-nav .nav-link {
    min-height: 48px;
    padding: 14px 16px;
    display: inline-flex;
    align-items: center;
}

/* 社群媒體圖示優化 */
.social-link,
.social-icon {
    min-width: 48px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}


/* ===== Typography & Readability ===== */

/* 基礎字體大小 (確保行動裝置可讀性) */
body {
    font-size: 16px;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
}

/* 標題層級 */
h1 {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    line-height: 1.2;
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    line-height: 1.3;
}

h3 {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    line-height: 1.4;
}

/* 段落最佳閱讀寬度 */
p {
    max-width: 70ch;
    font-size: 1rem;
    line-height: 1.7;
}

/* 確保連結足夠明顯 */
a {
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}


/* ===== Responsive Breakpoints ===== */

/* 小型手機 (< 576px) */
@media (max-width: 575.98px) {
    /* 加大觸控區域 */
    .btn {
        width: 100%;
        padding: 16px;
    }

    /* 確保表單元素全寬 */
    input,
    textarea,
    select {
        width: 100%;
    }

    /* 調整字體大小 */
    body {
        font-size: 15px;
    }
}

/* 平板裝置 (576px - 991px) */
@media (min-width: 576px) and (max-width: 991.98px) {
    /* 適當的觸控目標大小 */
    .btn {
        min-width: 120px;
    }
}

/* 桌面裝置 (>= 992px) */
@media (min-width: 992px) {
    /* 可以稍微減少觸控區域 (滑鼠使用) */
    a,
    button,
    .btn {
        min-height: 40px;
    }
}


/* ===== Accessibility Improvements ===== */

/* 焦點指示器 (鍵盤導航) */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 3px solid #005fcc;
    outline-offset: 2px;
}

/* 跳過導航連結 */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px;
    z-index: 10000;
}

.skip-link:focus {
    top: 0;
}

/* 減少動態效果 (前庭障礙用戶) */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


/* ===== Print Styles (SEO Friendly) ===== */

@media print {
    /* 隱藏不需要列印的元素 */
    nav,
    footer,
    .btn,
    .social-links {
        display: none !important;
    }

    /* 確保連結網址可見 */
    a[href]::after {
        content: " (" attr(href) ")";
    }

    /* 優化列印字體 */
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
}
