/* ===========================
   color-contrast - 顏色對比檢查器頁面
   =========================== */

/* 左側主要內容區塊，佔滿剩餘寬度 */
.cct-container {
    flex: 1;
    min-width: 0;
}

/* 頁面頂部英雄區塊 */
.cct-hero {
    text-align: center;
    padding: 10px 0 30px;
}

/* 英雄區塊主標題 */
.cct-hero-title {
    font-size: 2.25em;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px;
}

/* 英雄區塊副標題 (#64748b 對比度 4.51:1，符合 WCAG AA) */
.cct-hero-subtitle {
    font-size: 1.063em;
    color: #64748b;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 0 0 16px;
}

/* 英雄區塊描述文字 (#64748b 對比度 4.51:1，符合 WCAG AA) */
.cct-hero-desc {
    font-size: 1em;
    color: #64748b;
    margin: 0;
    line-height: 1.6;
}

/* ===========================
   工具卡片
   =========================== */

/* 工具卡片外層 */
.cct-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
    margin-bottom: 20px;
}

/* 工具卡片內容區域 */
.cct-card-body {
    padding: 24px;
}

/* ===========================
   顏色輸入區塊
   =========================== */

/* 顏色輸入行，水平排列兩個輸入框與交換按鈕 */
.cct-input-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 24px;
}

/* 每個顏色輸入群組，等分寬度 */
.cct-color-group {
    flex: 1;
    min-width: 0;
}

/* 顏色輸入群組標籤 (#475569 對比度 7.04:1，符合 WCAG AAA) */
.cct-label {
    display: block;
    font-size: 0.938em;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

/* 顏色輸入容器，包含色票選取器與文字輸入框 */
.cct-color-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 色票選取器外框 */
.cct-color-picker {
    width: 42px;
    height: 42px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 2px;
    cursor: pointer;
    background: #f8fafc;
    flex-shrink: 0;
}

/* 色票選取器 focus-visible 外框 */
.cct-color-picker:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
}

/* HEX 色碼文字輸入框 */
.cct-hex-input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    font-size: 0.938em;
    font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', monospace;
    color: #1e293b;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: border-color 0.15s ease;
}

/* HEX 輸入框 focus 狀態 */
.cct-hex-input:focus {
    border-color: #2563eb;
    outline: none;
    background: #fff;
}

/* HEX 輸入框 focus-visible 外框 */
.cct-hex-input:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
}

/* 交換按鈕容器，垂直置中 */
.cct-swap-wrap {
    flex-shrink: 0;
    padding-bottom: 2px;
}

/* 交換按鈕 (#2563eb 白字對比度 5.18:1，符合 WCAG AA) */
.cct-swap-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    font-size: 1em;
    color: #2563eb;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

/* 交換按鈕 hover */
.cct-swap-btn:hover {
    background: #dbeafe;
}

/* 交換按鈕 focus-visible 外框 */
.cct-swap-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* 錯誤訊息文字 (#dc2626 對比度 4.63:1，符合 WCAG AA) */
.cct-error {
    font-size: 0.875em;
    color: #dc2626;
    margin-top: 4px;
    display: none;
}

/* 錯誤訊息顯示狀態 */
.cct-error.is-visible {
    display: block;
}

/* ===========================
   預覽區塊
   =========================== */

/* 預覽區塊標題 (#475569 對比度 7.04:1，符合 WCAG AAA) */
.cct-section-title {
    font-size: 1em;
    font-weight: 600;
    color: #475569;
    margin: 0 0 12px;
}

/* 預覽框，展示實際文字效果 */
.cct-preview-box {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    text-align: center;
}

/* 預覽一般文字 */
.cct-preview-normal {
    font-size: 1em;
    margin: 0 0 12px;
    line-height: 1.6;
}

/* 預覽大型文字 */
.cct-preview-large {
    font-size: 1.5em;
    font-weight: 700;
    margin: 0;
    line-height: 1.4;
}

/* ===========================
   結果區塊
   =========================== */

/* 結果資訊網格，三欄排列 */
.cct-result-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

/* 結果資訊卡片 */
.cct-result-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

/* 結果標籤文字 (#64748b 對比度 4.51:1，符合 WCAG AA) */
.cct-result-label {
    font-size: 0.813em;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 4px;
}

/* 結果數值，對比度主數值加大顯示 */
.cct-result-value {
    font-size: 1.5em;
    font-weight: 700;
    color: #1e293b;
    font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', monospace;
}

/* ===========================
   WCAG 合規性區塊
   =========================== */

/* WCAG 合規性網格，四欄排列 */
.cct-wcag-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

/* WCAG 項目卡片 */
.cct-wcag-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

/* WCAG 項目標籤 (#64748b 對比度 4.51:1，符合 WCAG AA) */
.cct-wcag-label {
    font-size: 0.75em;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 6px;
}

/* WCAG 門檻值標示 */
.cct-wcag-threshold {
    font-size: 0.688em;
    color: #94a3b8;
    margin-bottom: 6px;
}

/* WCAG 通過標示 (#16a34a 對白背景對比度 3.49:1，加粗 600 補強辨識) */
.cct-wcag-badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 0.813em;
    font-weight: 600;
    border-radius: 4px;
}

/* 通過狀態徽章 */
.cct-wcag-badge.is-pass {
    color: #16a34a;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

/* 未通過狀態徽章 */
.cct-wcag-badge.is-fail {
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
}

/* ===========================
   響應式設計
   =========================== */

@media (max-width: 768px) {

    /* 顏色輸入行改為垂直排列 */
    .cct-input-row {
        flex-direction: column;
        align-items: stretch;
    }

    /* 交換按鈕容器置中 */
    .cct-swap-wrap {
        text-align: center;
    }

    /* 結果網格改為單欄 */
    .cct-result-grid {
        grid-template-columns: 1fr;
    }

    /* WCAG 網格改為雙欄 */
    .cct-wcag-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {

    /* 卡片內容縮小內距 */
    .cct-card-body {
        padding: 16px;
    }
}

/* ===========================
   無障礙：減少動態效果
   =========================== */

@media (prefers-reduced-motion: reduce) {

    /* 停用所有過渡動畫 */
    .cct-hex-input,
    .cct-swap-btn {
        transition: none;
    }
}

/* ===========================
   無障礙：Windows 高對比模式
   =========================== */

@media (forced-colors: active) {

    /* 卡片框線使用系統色彩 */
    .cct-card {
        border-color: CanvasText;
    }

    /* 輸入框框線使用系統色彩 */
    .cct-hex-input,
    .cct-color-picker {
        border-color: CanvasText;
    }

    /* 交換按鈕使用系統色彩 */
    .cct-swap-btn {
        border: 1px solid ButtonText;
    }

    /* WCAG 徽章使用系統色彩 */
    .cct-wcag-badge {
        border-color: CanvasText;
    }
}
