/* ==============================
   全站共用樣式 - 芯片架構歷史介紹
   ============================== */

/* 重置樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: '微軟正黑體', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* ==============================
   Header 樣式
   ============================== */
header {
    background-color: #919191;
    color: white;
    padding: 1rem;
    text-align: center;
}

/* ==============================
   導航列樣式
   ============================== */
nav {
    background-color: #919191;
    padding: 1rem;
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
}

nav ul li {
    margin: 0 1rem;
}

nav ul li a {
    color: white;
    text-decoration: none;
}

/* 當前選中的導航項目 */
nav ul li a:hover {
    color: #ddd;
}

/* ==============================
   下拉選單樣式
   ============================== */
.dropdown {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #919191;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    min-width: 160px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 100;
    border-radius: 4px;
}

.dropdown-content a {
    color: white;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: center;
    cursor: pointer;
}

/* 確保懸停時顯示下拉選單 */
.dropdown:hover .dropdown-content {
    display: block;
}

/* 點擊時顯示下拉選單 */
.dropdown.active .dropdown-content {
    display: block;
}

/* 選項懸停效果 */
.dropdown-content a:hover {
    background-color: #5a5a5a;
    transition: background-color 0.3s ease;
}

/* ==============================
   文章內容區域
   ============================== */
.article-content {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.section {
    margin-bottom: 3rem;
}

.section-title {
    color: #919191;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #919191;
    padding-bottom: 0.5rem;
}

/* ==============================
   首頁專屬樣式
   ============================== */
.hero {
    background-image: linear-gradient(rgba(50, 50, 50, 0.5), rgba(50, 50, 50, 0.5)), url('/1200px-KL_Intel_D8086 .jpg');
    height: 400px;
    background-position: center;
    background-size: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
}

.content {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.timeline {
    margin: 2rem 0;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 8px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.feature-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ==============================
   通用卡片樣式
   ============================== */
.architecture-card,
.info-card,
.component-card,
.principle-card,
.cisc-card,
.risc-card,
.modern-card,
.moore-card,
.tech-card,
.quantum-card,
.document-card,
.news-card,
.resource-card {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ==============================
   時間軸卡片樣式 (early.html)
   ============================== */
.timeline-card {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
}

.timeline-card::before {
    content: '';
    position: absolute;
    width: 2px;
    height: 100%;
    background: #919191;
    left: -20px;
    top: 0;
}

.year-tag {
    background: #919191;
    color: white;
    padding: 0.2rem 0.8rem;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 0.5rem;
}

/* ==============================
   圖片樣式
   ============================== */
.component-image {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
    border-radius: 4px;
}

/* ==============================
   特色列表樣式
   ============================== */
.feature-list {
    list-style: none;
    padding-left: 1rem;
    margin-top: 0.5rem;
}

.feature-list li {
    margin-bottom: 0.5rem;
    position: relative;
    padding-left: 1.5rem;
}

.feature-list li:before {
    content: "•";
    color: #919191;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* ==============================
   步驟列表樣式 (principles.html)
   ============================== */
.step-list {
    list-style: none;
    padding-left: 1rem;
}

.step-list li {
    margin-bottom: 1rem;
    position: relative;
    padding-left: 2rem;
}

.step-list li:before {
    content: "•";
    counter-increment: step-counter;
    position: absolute;
    left: 0;
    color: #919191;
    font-weight: bold;
}

/* ==============================
   強調區塊樣式
   ============================== */
.highlight-box {
    background: #e2e1e1;
    border-left: 4px solid #919191;
    padding: 1rem;
    margin: 1rem 0;
}

/* ==============================
   文件卡片標題
   ============================== */
.document-card h3 {
    margin-top: 1rem;
    color: #919191;
}

/* ==============================
   新聞卡片樣式
   ============================== */
.news-card h3 {
    margin-bottom: 0.5rem;
    color: #919191;
}

.news-card p {
    margin-bottom: 0.5rem;
}

.news-card a {
    color: #333;
    text-decoration: none;
}

.news-card a:hover {
    text-decoration: underline;
}

/* ==============================
   資源卡片樣式
   ============================== */
.resource-card h3 {
    margin-bottom: 0.5rem;
    color: #919191;
}

.resource-card p {
    margin-bottom: 0.5rem;
}

.resource-card a {
    color: #919191;
    text-decoration: none;
}

.resource-card a:hover {
    text-decoration: underline;
}

/* ==============================
   漢堡選單按鈕樣式
   ============================== */
.menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem;
    background: #919191;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1000;
}

/* ==============================
   媒體查詢：螢幕寬度小於 768px 時的樣式
   ============================== */
@media screen and (max-width: 768px) {
    /* 顯示漢堡選單按鈕 */
    .menu-toggle {
        display: block;
    }

    /* 修改導航列樣式 */
    nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100vh;
        background-color: #919191;
        transition: right 0.3s ease;
        z-index: 999;
    }

    /* 選單開啟時的樣式 */
    nav.active {
        right: 0;
    }

    /* 修改導航列表樣式 */
    nav ul {
        flex-direction: column;
        padding-top: 60px;
    }

    nav ul li {
        margin: 1rem 0;
    }

    /* 修改下拉選單樣式 */
    .dropdown-content {
        position: static;
        transform: none;
        box-shadow: none;
        background-color: #808080;
        display: none;
    }

    .dropdown.active .dropdown-content {
        display: block;
    }

    /* 固定標題欄位 */
    header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
    }

    /* 為 body 添加上方 padding，防止內容被固定 header 遮擋 */
    body {
        padding-top: 60px;
    }

    /* 確保漢堡選單按鈕在適當位置 */
    .menu-toggle {
        top: 15px;
        right: 15px;
    }

    /* 調整導航選單的位置 */
    nav {
        margin-top: 60px;
    }

    /* 導航選單項目樣式 */
    nav ul li {
        width: 100%;
        margin: 0;
    }

    nav ul li a {
        display: block;
        width: 100%;
        text-align: center;
        padding: 1rem;
    }

    /* 下拉選單容器樣式 */
    .dropdown {
        width: 100%;
    }

    /* 下拉選單內容樣式 */
    .dropdown-content {
        width: 100%;
        position: static;
        transform: none;
    }

    .dropdown-content a {
        display: block;
        width: 100%;
        text-align: center;
        padding: 1rem;
        background-color: #808080;
    }

    /* 懸停效果 */
    nav ul li a:hover,
    .dropdown-content a:hover {
        background-color: #5a5a5a;
    }
}

/* ==============================
   底部互動按鈕樣式 (Vue 轉換版)
   ============================== */
.vue-button-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-top: 2rem;
    box-sizing: border-box;
}

/* ==============================
   歪像按鈕 (Anamorphosis) 3D 樣式
   ============================== */
.anamorphosis-stage {
    position: relative;
    width: 200px;
    height: 60px;
    margin: 0 auto;
    perspective: 1000px; /* 創造 3D 景深 */
    cursor: grab;
    touch-action: none;
}

.anamorphosis-stage:active {
    cursor: grabbing;
}

/* 藏在底下的真實按鈕 */
.real-btn {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #8688d9, #3b82f6);
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    opacity: 0; /* 初始隱藏 */
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.real-btn.unlocked {
    opacity: 1;
    pointer-events: auto;
}

.real-btn.unlocked:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* 3D 碎片容器 */
.puzzle-wrapper {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    transform-style: preserve-3d; /* 讓子元素保持 3D 空間關係 */
    /* 旋轉角度由 JS 動態控制 */
    -webkit-transform-style: preserve-3d; /* 加上這行支援 iOS */
    transform: rotateX(var(--rx, 45deg)) rotateY(var(--ry, -45deg));
}

/* 每一塊碎片的共用樣式 */
.puzzle-slice {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(135deg, #6366f1, #3b82f6);
    border-radius: 9999px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden; /* 加上這行支援 iOS */
}

.instruction-text {
    text-align: center;
    color: #6b7280;
    font-size: 0.9rem;
    margin-top: 1rem;
    transition: color 0.3s;
}