/* 全域重置與基礎樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 顏色系統 - 基於主色 #FF537B */
:root {
    /* 主色系 */
    --primary-color: #FF537B;
    --primary-light: #FF7A9B;
    --primary-dark: #E63956;
    --primary-darker: #C9184A;
    
    /* 次要色系 */
    --secondary-color: #F3E4C9;
    --secondary-light: #F8E7D1;
    --secondary-dark: #D4B896;
    
    /* 中性色系 */
    --text-primary: #2D3436;
    --text-secondary: #636E72;
    --text-light: #95A5A6;
    --background: #F8F9FA;
    --surface: #FFFFFF;
    --border: #E9ECEF;
    
    /* 語意色彩 */
    --success: #27AE60;
    --warning: #F39C12;
    --error: #E74C3C;
    
    /* 設計權杖 */
    --border-radius: 12px;
    --border-radius-lg: 20px;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --transition: all 0.2s ease;
}

body {
    font-family: 'Noto Sans TC', 'Microsoft JhengHei', '微軟正黑體', sans-serif;
    line-height: 1.7;
    color: var(--text-primary);
    background-color: var(--background);
    font-weight: 400;
    letter-spacing: 0.02em;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 字級階層系統 */
h1, h2, h3, h4 {
    font-family: 'Noto Serif TC', serif;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    line-height: 1.3;
}

h1 {
    font-size: 2.5rem;
    color: var(--primary-dark);
    font-weight: 700;
}

h2 {
    font-size: 2rem;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: var(--spacing-lg);
    font-weight: 600;
}

h3 {
    font-size: 1.3rem;
    color: var(--primary-darker);
    font-weight: 500;
}

h4 {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* 內文字級 */
p {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: var(--spacing-sm);
    color: var(--text-secondary);
}

/* 小字與說明文字 */
.small-text {
    font-size: 0.875rem;
    color: var(--text-light);
    line-height: 1.6;
}

.caption-text {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 400;
}

/* 導航列樣式 */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: var(--spacing-sm) 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(111, 207, 151, 0.2);
    backdrop-filter: blur(10px);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius);
}

nav a:hover {
    color: var(--primary-light);
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

/* 主內容區域 */
main {
    margin-top: 80px;
}

/* 英雄區塊 */
#hero {
    background: linear-gradient(rgba(111, 207, 151, 0.9), rgba(76, 175, 112, 0.9)),
                url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 600"><rect fill="%23F8F9FA" width="1200" height="600"/><path fill="%236FCF97" d="M0 300h1200v300H0z"/></svg>');
    background-size: cover;
    background-position: center;
    height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.hero-content h2 {
    font-size: 3rem;
    margin-bottom: var(--spacing-sm);
    color: white;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.3);
    font-weight: 700;
    font-family: 'Noto Serif TC', serif;
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: var(--spacing-lg);
    color: var(--secondary-light);
    font-weight: 400;
}

.cta-button {
    background: var(--secondary-color);
    color: var(--primary-dark);
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 20px rgba(255, 83, 123, 0.3);
    font-family: 'Noto Sans TC', sans-serif;
}

.cta-button:hover {
    background: var(--secondary-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 83, 123, 0.4);
}

/* 區塊通用樣式 */
section {
    padding: var(--spacing-xl) 0;
}

section:nth-child(even) {
    background-color: var(--surface);
}

/* 歷史沿革區塊 */
.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

.history-item {
    background: var(--surface);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    transition: var(--transition);
    border-left: 5px solid var(--primary-color);
    position: relative;
    overflow: hidden;
}

.history-item::before {
    content: '\f1da'; /* Font Awesome 歷史圖示 */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    font-size: 1.5rem;
    color: var(--primary-light);
    opacity: 0.3;
}

.history-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(111, 207, 151, 0.15);
    border-left-color: var(--primary-dark);
}

/* 技藝展示區塊 */
.techniques-showcase {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

.technique-card {
    background: linear-gradient(135deg, var(--surface) 0%, var(--background) 100%);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    transition: var(--transition);
    border: 2px solid transparent;
    position: relative;
}

.technique-card::before {
    content: '\f5ad'; /* Font Awesome 工具圖示 */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.2rem;
    color: var(--primary-color);
    background: var(--surface);
    padding: var(--spacing-xs);
    border-radius: 50%;
}

.technique-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(111, 207, 151, 0.2);
}

/* 織布種類區塊 */
.types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

.type-item {
    background: linear-gradient(135deg, var(--surface) 0%, #FFFFFF 100%);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    transition: var(--transition);
    border-left: 5px solid var(--primary-light);
    position: relative;
    overflow: hidden;
}

.type-item::before {
    content: '\f53f'; /* Font Awesome 織布圖示 */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, rgba(111, 207, 151, 0.1) 0%, rgba(76, 175, 112, 0.05) 100%);
    border-radius: 0 var(--border-radius) 0 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.type-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(111, 207, 151, 0.2);
    border-left-color: var(--primary-color);
}

.type-item h3 {
    color: var(--primary-dark);
    margin-bottom: var(--spacing-sm);
    font-size: 1.4rem;
    position: relative;
    z-index: 1;
    font-weight: 600;
}

.type-item p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: var(--spacing-md);
    position: relative;
    z-index: 1;
}

.type-features {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    position: relative;
    z-index: 1;
}

.feature-tag {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
    border: none;
}

.feature-tag:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    transform: scale(1.05);
}

/* 工具介紹區塊 */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

.tool-item {
    background: linear-gradient(135deg, var(--background) 0%, var(--surface) 100%);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    transition: var(--transition);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.tool-item::before {
    content: '\f5ad'; /* Font Awesome 工具圖示 */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 0;
    left: 0;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, rgba(111, 207, 151, 0.1) 0%, rgba(76, 175, 112, 0.05) 100%);
    border-radius: 0 0 var(--border-radius) 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1rem;
}

.tool-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(111, 207, 151, 0.2);
    border-color: var(--primary-color);
}

.tool-item h3 {
    color: var(--primary-dark);
    margin-bottom: var(--spacing-sm);
    font-size: 1.3rem;
    position: relative;
    z-index: 1;
    font-weight: 600;
}

.tool-item p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: var(--spacing-md);
    position: relative;
    z-index: 1;
}

.tool-details {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    position: relative;
    z-index: 1;
}

.tool-tag {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
    border: none;
}

.tool-tag:hover {
    background: linear-gradient(135deg, var(--primary-darker) 0%, var(--primary-dark) 100%);
    transform: scale(1.05);
}

/* 部落特色區塊 */
.tribes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

.tribe-item {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: 0 5px 20px rgba(111, 207, 151, 0.3);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.tribe-item::before {
    content: '\f500'; /* Font Awesome 部落圖示 */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.3);
}

.tribe-item:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 30px rgba(111, 207, 151, 0.4);
}

.tribe-item h3 {
    color: var(--secondary-light);
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.tribe-item p {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.7;
    position: relative;
    z-index: 1;
}

/* 展覽區塊 */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

.gallery-item {
    background: var(--surface);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.gallery-item::before {
    content: '\f03e'; /* Font Awesome 圖片圖示 */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1rem;
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.9);
    padding: var(--spacing-xs);
    border-radius: 50%;
    opacity: 0;
    transition: var(--transition);
    z-index: 2;
}

.gallery-item:hover::before {
    opacity: 1;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(111, 207, 151, 0.2);
}

.gallery-placeholder {
    height: 200px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    position: relative;
}

.gallery-placeholder::before {
    content: '\f302'; /* Font Awesome 相機圖示 */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.3);
}

.gallery-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.gallery-item h3 {
    padding: var(--spacing-sm) var(--spacing-md) var(--spacing-xs);
    color: var(--primary-dark);
    font-weight: 600;
}

.gallery-item p {
    padding: 0 var(--spacing-md) var(--spacing-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* 彈窗樣式 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(45, 52, 54, 0.8);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: var(--surface);
    margin: 5% auto;
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    position: relative;
    animation: slideIn 0.3s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.close {
    color: var(--text-light);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: var(--spacing-md);
    top: var(--spacing-sm);
    transition: var(--transition);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close:hover {
    color: var(--primary-color);
    background-color: var(--background);
    transform: rotate(90deg);
}

/* 頁尾樣式 */
footer {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: white;
    text-align: center;
    padding: var(--spacing-lg) 0;
    position: relative;
    overflow: hidden;
}

footer::before {
    content: '\f1da'; /* Font Awesome 歷史圖示 */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8rem;
    color: rgba(255, 255, 255, 0.05);
    z-index: 0;
}

footer p {
    margin-bottom: var(--spacing-xs);
    position: relative;
    z-index: 1;
    line-height: 1.6;
}

/* 動畫效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-50px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* 響應式設計 - 手機優先 */
/* 基礎手機樣式 (375px+) */
@media (max-width: 1200px) {
    .container {
        max-width: 960px;
    }
    
    h1 {
        font-size: 2.2rem;
    }
    
    h2 {
        font-size: 1.8rem;
    }
}

@media (max-width: 768px) {
    nav {
        flex-direction: column;
        gap: var(--spacing-sm);
        padding: var(--spacing-sm) 20px;
    }
    
    nav ul {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-sm);
        flex-wrap: wrap;
    }
    
    nav li {
        flex: 1 1 auto;
        min-width: 120px;
    }
    
    .hero-content h2 {
        font-size: 2rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }
    
    main {
        margin-top: 120px;
    }
    
    section {
        padding: var(--spacing-lg) 0;
    }
    
    .history-grid,
    .techniques-showcase,
    .types-grid,
    .tools-grid,
    .tribes-grid,
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .type-item {
        min-width: 280px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .hero-content {
        padding: 0 20px;
    }
    
    .cta-button {
        padding: 12px 25px;
        font-size: 1rem;
    }
    
    .history-item,
    .technique-card,
    .type-item,
    .tool-item,
    .tribe-item {
        padding: var(--spacing-md);
    }
    
    nav ul {
        gap: 0.5rem;
    }
    
    nav a {
        padding: 0.3rem 0.6rem;
        font-size: 0.9rem;
    }
}

/* 超小螢幕優化 */
@media (max-width: 375px) {
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    .hero-content h2 {
        font-size: 1.6rem;
    }
    
    .hero-content p {
        font-size: 0.9rem;
    }
    
    .container {
        padding: 0 10px;
    }
    
    main {
        margin-top: 100px;
    }
}

/* 程式碼字體設定 */
code, pre {
    font-family: 'Courier New', monospace;
    background-color: var(--background);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

pre {
    padding: var(--spacing-sm);
    overflow-x: auto;
    border: 1px solid var(--border);
}

/* 平滑滾動 */
html {
    scroll-behavior: smooth;
}

/* 載入動畫 */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 無障礙優化 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* 高對比模式支援 */
@media (prefers-contrast: high) {
    :root {
        --text-primary: #000000;
        --text-secondary: #333333;
        --border: #000000;
        --primary-color: #0066CC;
    }
}

/* 列印樣式 */
@media print {
    header, footer, .modal {
        display: none;
    }
    
    main {
        margin-top: 0;
    }
    
    section {
        padding: 1rem 0;
        page-break-inside: avoid;
    }
    
    .history-item, .technique-card, .type-item, .tool-item, .tribe-item, .gallery-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
