/* ============================================================
   紀謙的自在空間 - 全域樣式檔案 (global-style.css)
   統一字體大小、行高、間距、容器寬度
   各頁面配色保持獨立設定
   ============================================================ */

/* ===== Google Fonts 引入 ===== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;500;600;700&display=swap');

/* ===== CSS 變數定義 ===== */
:root {
    /* ----- 字體家族 ----- */
    --font-primary: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei", sans-serif;
    --font-mono: 'SF Mono', 'Monaco', 'Consolas', monospace;
    
    /* ----- 基礎字體大小 ----- */
    --font-size-base: 16px;
    
    /* ----- 字體大小比例 (使用 rem 統一單位) ----- */
    --text-xs: 0.75rem;      /* 12px - 極小文字、標籤 */
    --text-sm: 0.875rem;     /* 14px - 小字、輔助說明 */
    --text-base: 1rem;       /* 16px - 內文基準 */
    --text-lg: 1.125rem;     /* 18px - 大內文、強調 */
    --text-xl: 1.25rem;      /* 20px - 小標題 */
    --text-2xl: 1.5rem;      /* 24px - H4 */
    --text-3xl: 1.875rem;    /* 30px - H3 */
    --text-4xl: 2.25rem;     /* 36px - H2 */
    --text-5xl: 3rem;        /* 48px - H1 */
    --text-6xl: 3.75rem;     /* 60px - 超大標題 */
    
    /* ----- 字重 ----- */
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    
    /* ----- 行高 ----- */
    --leading-none: 1;
    --leading-tight: 1.25;    /* 標題用 */
    --leading-snug: 1.4;      /* 緊湊內文 */
    --leading-normal: 1.6;    /* 一般內文 */
    --leading-relaxed: 1.8;   /* 舒適閱讀 */
    --leading-loose: 2;       /* 寬鬆、強調用 */
    
    /* ----- 字距 ----- */
    --tracking-tight: -0.02em;
    --tracking-normal: 0;
    --tracking-wide: 0.05em;
    --tracking-wider: 0.1em;
    
    /* ----- 容器寬度 ----- */
    --container-xs: 480px;    /* 極窄容器 */
    --container-sm: 640px;    /* 小容器 */
    --container-md: 768px;    /* 中容器 */
    --container-lg: 900px;    /* 文章內容 */
    --container-xl: 1024px;   /* 寬內容 */
    --container-2xl: 1200px;  /* 最大容器 */
    
    /* ----- 間距系統 ----- */
    --space-0: 0;
    --space-1: 0.25rem;   /* 4px */
    --space-2: 0.5rem;    /* 8px */
    --space-3: 0.75rem;   /* 12px */
    --space-4: 1rem;      /* 16px */
    --space-5: 1.25rem;   /* 20px */
    --space-6: 1.5rem;    /* 24px */
    --space-8: 2rem;      /* 32px */
    --space-10: 2.5rem;   /* 40px */
    --space-12: 3rem;     /* 48px */
    --space-16: 4rem;     /* 64px */
    --space-20: 5rem;     /* 80px */
    --space-24: 6rem;     /* 96px */
    
    /* ----- 圓角 ----- */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 50px;
    --radius-circle: 50%;
    
    /* ----- 陰影 ----- */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.15);
    
    /* ----- 動畫時間 ----- */
    --transition-fast: 150ms;
    --transition-normal: 250ms;
    --transition-slow: 350ms;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===== 基礎重置 ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== HTML & Body 基礎設定 ===== */
html {
    font-size: var(--font-size-base);
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    line-height: var(--leading-relaxed);
    overflow-x: hidden;
}

/* ===== 標題統一樣式 ===== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-primary);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
}

h1, .h1 {
    font-size: var(--text-5xl);
    margin-bottom: var(--space-6);
}

h2, .h2 {
    font-size: var(--text-4xl);
    margin-bottom: var(--space-5);
}

h3, .h3 {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-4);
}

h4, .h4 {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-4);
}

h5, .h5 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-3);
}

h6, .h6 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-3);
}

/* ===== 段落與內文 ===== */
p {
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-5);
}

/* 大內文 - 用於開場白、重點段落 */
.text-large,
.lead {
    font-size: var(--text-lg);
    line-height: var(--leading-loose);
}

/* 小內文 - 用於輔助說明、註解 */
.text-small,
.caption {
    font-size: var(--text-sm);
    line-height: var(--leading-normal);
}

/* ===== 連結 ===== */
a {
    text-decoration: none;
    transition: color var(--transition-fast) var(--ease-out);
}

a:hover {
    text-decoration: none;
}

/* ===== 列表 ===== */
ul, ol {
    padding-left: var(--space-6);
    margin-bottom: var(--space-5);
}

li {
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-2);
}

/* ===== 引言區塊 ===== */
blockquote,
.quote {
    font-size: var(--text-lg);
    font-style: italic;
    line-height: var(--leading-loose);
    padding: var(--space-6) var(--space-8);
    margin: var(--space-6) 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* ===== 重點區塊 ===== */
.highlight {
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
    padding: var(--space-6) var(--space-8);
    border-radius: var(--radius-md);
    margin: var(--space-6) 0;
}

.highlight p {
    margin-bottom: var(--space-3);
}

.highlight p:last-child {
    margin-bottom: 0;
}

/* ===== 按鈕基礎樣式 ===== */
.btn,
button {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    line-height: 1.5;
    padding: var(--space-4) var(--space-8);
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    transition: all var(--transition-normal) var(--ease-out);
}

.btn-large {
    font-size: var(--text-lg);
    padding: var(--space-5) var(--space-10);
}

.btn-small {
    font-size: var(--text-sm);
    padding: var(--space-2) var(--space-5);
}

/* ===== 標籤/徽章 ===== */
.badge,
.tag {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    display: inline-block;
}

/* ===== 卡片內文字 ===== */
.card-title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    line-height: var(--leading-snug);
    margin-bottom: var(--space-3);
}

.card-description {
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
}

/* ===== 價格顯示 ===== */
.price {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
}

.price-original {
    font-size: var(--text-sm);
    text-decoration: line-through;
    opacity: 0.6;
}

/* ===== 表單元素 ===== */
input,
textarea,
select {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
}

label {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    display: block;
    margin-bottom: var(--space-2);
}

/* ===== Footer 文字 ===== */
.footer-text {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
}

.footer-heading {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-4);
}

/* ===== 容器類別 ===== */
.container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-5);
    padding-right: var(--space-5);
}

.container-sm {
    max-width: var(--container-sm);
}

.container-md {
    max-width: var(--container-md);
}

.container-lg {
    max-width: var(--container-lg);
}

.container-xl {
    max-width: var(--container-xl);
}

.container-2xl {
    max-width: var(--container-2xl);
}

/* ===== 區塊間距 ===== */
.section {
    padding-top: var(--space-16);
    padding-bottom: var(--space-16);
}

.section-sm {
    padding-top: var(--space-12);
    padding-bottom: var(--space-12);
}

.section-lg {
    padding-top: var(--space-20);
    padding-bottom: var(--space-20);
}

/* ===== 文字對齊工具類 ===== */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

/* ===== 字重工具類 ===== */
.font-light { font-weight: var(--font-light); }
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

/* ===== RWD 響應式字體調整 ===== */
@media (max-width: 1024px) {
    :root {
        --text-5xl: 2.5rem;   /* 40px */
        --text-4xl: 2rem;     /* 32px */
        --text-3xl: 1.5rem;   /* 24px */
    }
    
    .section {
        padding-top: var(--space-12);
        padding-bottom: var(--space-12);
    }
}

@media (max-width: 768px) {
    :root {
        --text-6xl: 2.5rem;   /* 40px */
        --text-5xl: 2rem;     /* 32px */
        --text-4xl: 1.75rem;  /* 28px */
        --text-3xl: 1.375rem; /* 22px */
        --text-2xl: 1.25rem;  /* 20px */
    }
    
    .container {
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }
    
    .section {
        padding-top: var(--space-10);
        padding-bottom: var(--space-10);
    }
    
    h1, .h1 {
        margin-bottom: var(--space-5);
    }
    
    h2, .h2 {
        margin-bottom: var(--space-4);
    }
    
    blockquote,
    .quote,
    .highlight {
        padding: var(--space-5) var(--space-6);
    }
}

@media (max-width: 480px) {
    :root {
        --text-5xl: 1.875rem; /* 30px */
        --text-4xl: 1.5rem;   /* 24px */
        --text-3xl: 1.25rem;  /* 20px */
    }
    
    .btn {
        padding: var(--space-3) var(--space-6);
    }
    
    .btn-large {
        font-size: var(--text-base);
        padding: var(--space-4) var(--space-8);
    }
}

/* ===== 列印樣式 ===== */
@media print {
    :root {
        --text-base: 12pt;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    h1 { font-size: 24pt; }
    h2 { font-size: 18pt; }
    h3 { font-size: 14pt; }
}
