/* ===================================================================
   init.css - 16px基準 rem 升級版 (最終成品)
   =================================================================== */

/* ===================================================================
   1. 全域變數 & 基礎設定
   =================================================================== */
:root {
    --header-height: 4.375rem; /* 70px / 16 = 4.375rem */
}

body {
    font-family: Arial, sans-serif;
    font-size: 1rem; /* 預設 1rem = 16px */
    color: #333;
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

/* ===================================================================
   1.5 字體排印學 (Typography)
   =================================================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: bold;
    margin: 0;
}

h1 { font-size: 2rem; }      /* 32px / 16 = 2rem */
h2 { font-size: 1.75rem; }   /* 28px / 16 = 1.75rem */
h3 { font-size: 1.5rem; }    /* 24px / 16 = 1.5rem */
p {
    margin: 0;
}

/* ===================================================================
   2. Header 元件
   =================================================================== */
header {
    position: fixed;
    height: var(--header-height);
    top: 0;
    left: 0;
    right: 0;
    background: #333;
    color: #fff;
    padding: 1rem 0; /* 16px -> 1rem */
    padding-left: 1.875rem; /* 30px -> 1.875rem */
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 340px; /* 380px -> 23.75rem */
}

.header-fill {
    height: 0.625rem; /* 10px -> 0.625rem */
    background-color: #2894FF;
    width: 100%;
    position: absolute;
    top: 6.25rem; /* 100px -> 6.25rem */
    left: 0;
    box-shadow: 0 0.125rem 0.625rem rgba(0, 0, 0, 0.5); /* 2px, 10px */
}

nav {
    position: absolute;
    top: 60%;
    right: 0.625rem; /* 10px -> 0.625rem */
    text-align: right;
}

.title-container {
    display: flex;
    align-items: center;
}

.title-img {
    width: 6.25rem; /* 100px -> 6.25rem */
    height: auto;
    margin-right: 1.875rem; /* 30px -> 1.875rem */
    cursor: pointer;
}

header h1 { font-size: 1.75rem; } /* 28px -> 1.75rem */
header p { font-size: 1.25rem; }  /* 20px -> 1.25rem */

nav a {
    margin: 0 1rem; /* 16px -> 1rem */
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    white-space: nowrap;
}

nav a:hover {
    text-decoration: underline;
}

/* ===================================================================
   3. 通用工具 (淡入淡出、聊天按鈕等)
   =================================================================== */
#fade-in, #fade-out {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: black;
    transition: opacity 1s ease;
    z-index: 1111;
}

.chat-button {
    position: fixed;
    bottom: 1.875rem; /* 30px -> 1.875rem */
    right: 1.875rem;  /* 30px -> 1.875rem */
    background-color: transparent;
    border: none;
    border-radius: 50%;
    width: 4.375rem;  /* 70px -> 4.375rem */
    height: 4.375rem; /* 70px -> 4.375rem */
    text-align: center;
    cursor: pointer;
    box-shadow: 0 0.125rem 0.625rem rgba(0, 0, 0, 0.5); /* 2px, 10px */
    z-index: 1002;
    padding: 0;
}

.chat-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: 0 0.125rem 0.625rem rgba(0, 0, 0, 0.5); /* 2px, 10px */
}

.tooltip {
    display: block;
    width: 8.125rem; /* 130px -> 8.125rem */
    position: absolute;
    right: 5rem; /* 80px -> 5rem */
    bottom: 0.4375rem; /* 7px -> 0.4375rem */
    background-color: white;
    color: #333;
    padding: 0.5rem; /* 8px -> 0.5rem */
    border: 1px solid #ccc; /* 細邊框保留 px */
    border-radius: 1.5rem; /* 24px -> 1.5rem */
    box-shadow: 0 0.125rem 0.625rem rgba(0, 0, 0, 0.2); /* 2px, 10px */
    white-space: nowrap;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform: translateX(1.25rem); /* 20px -> 1.25rem */
    opacity: 0;
    font-size: 1.75rem; /* 28px -> 1.75rem */
    font-family: Arial, sans-serif;
    font-weight: bold;
}

.chat-button:hover .tooltip {
    transform: translateX(0);
    opacity: 1;
}

/* ===================================================================
   4. 響應式設計 (只針對共用元件)
   =================================================================== */
/* 斷點 (breakpoint) 保留 px 單位，讓行為更可預測 */
@media (max-width: 870px) {
    :root { --header-height: 5.625rem; } /* 90px -> 5.625rem */
    .header-fill { top: 7.5rem; }     /* 120px -> 7.5rem */
    nav { top: 5.8125rem; }           /* 93px -> 5.8125rem */
}

@media (max-width: 499px) {
    :root { --header-height: 5.625rem; } /* 90px -> 5.625rem */
    .header-fill { top: 7.5rem; }     /* 120px -> 7.5rem */
    nav { top: 5.8125rem; }           /* 93px -> 5.8125rem */
    nav a { margin: 0 0.6rem; }       /* 9.6px -> 0.6rem */
}

/* ===================================================================
   5. 大螢幕響應式設計 (Widescreen Scaling) - ✨ 放大器 ✨
   =================================================================== */

/* 當螢幕寬度小於等於 440px 時 (例如 Full HD 或更大的螢幕) */
@media (max-width: 440px) {
    html {
        /*
         * 魔法就在這裡！
         * 我們把 html 的基礎字體大小，從預設的 100% (16px) 放大到 112.5%。
         * 這會讓 1rem 的價值，從 16px 自動變成 16px * 1.125 = 18px。
         * 於是，所有用 rem 設定的尺寸，都會等比例地、自動地放大 12.5%！
         * 你可以自由調整這個百分比，例如 125% 就是放大 25%。
         */
        font-size: 87.5%; 
    }
}

/* 當螢幕寬度大於等於 1920px 時 (例如 Full HD 或更大的螢幕) */
@media (min-width: 1920px) {
    html {
        /*
         * 魔法就在這裡！
         * 我們把 html 的基礎字體大小，從預設的 100% (16px) 放大到 112.5%。
         * 這會讓 1rem 的價值，從 16px 自動變成 16px * 1.125 = 18px。
         * 於是，所有用 rem 設定的尺寸，都會等比例地、自動地放大 12.5%！
         * 你可以自由調整這個百分比，例如 125% 就是放大 25%。
         */
        font-size: 112.5%; 
    }
}

/* 你還可以為更大的螢幕設定更大的放大倍率！(可選) */
/* 例如，當螢幕寬度大於等於 2560px 時 (2K 螢幕) */
@media (min-width: 2560px) {
    html {
        /* 把基礎字體大小放大到 125%，讓 1rem = 20px */
        font-size: 125%;
    }
}