/* style.css - 網站核心樣式 (修復版) */

/* --- 1. 基本設定 --- */
:root {
    --bg-color: #f5f5f5;
    --text-color: #1a1a1a;
    --accent-color: #666;
    --font-serif: 'Playfair Display', 'Noto Serif TC', serif;
    --font-sans: 'Lato', 'Noto Serif TC', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-sans);
    line-height: 1.6;
    opacity: 0;
    animation: fadeIn 1s forwards;
}

@keyframes fadeIn { to { opacity: 1; } }

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }

/* --- 2. 導覽列 (Header) --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 5%;
    background-color: var(--bg-color);
    position: relative;
    z-index: 100;
}

.logo {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.logo span {
    display: block;
    font-size: 0.9rem;
    font-family: var(--font-sans);
    font-weight: 300;
    margin-top: -5px;
    color: var(--accent-color);
}

nav ul { display: flex; gap: 2rem; }
nav a {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #999;
}
nav a:hover, nav a.active {
    color: #000;
    border-bottom: 1px solid #000;
}

.menu-toggle {
    display: none;
    width: 42px;
    height: 36px;
    border: none;
    border-radius: 999px;
    background: rgba(245, 245, 245, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: transparent;
    font-size: 0;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.menu-toggle::before,
.menu-toggle::after {
    content: "";
    position: absolute;
    left: 10px;
    width: 20px;
    height: 2px;
    background: rgba(24, 24, 24, 0.85);
    transition: transform 0.25s ease, top 0.25s ease, opacity 0.25s ease;
}

.menu-toggle::before {
    top: 12px;
    box-shadow: 0 6px 0 rgba(24, 24, 24, 0.85);
}

.menu-toggle::after {
    top: 24px;
}

.menu-toggle.open::before {
    top: 17px;
    transform: rotate(45deg);
    box-shadow: none;
}

.menu-toggle.open::after {
    top: 17px;
    transform: rotate(-45deg);
}

.menu-toggle:hover {
    background: rgba(245, 245, 245, 0.78);
}

.menu-toggle:active {
    transform: scale(0.96);
}

/* --- 3. 首頁全螢幕圖片 (Hero Image) --- */
.hero-container {
    position: relative;
    width: 90%; /* 依照你原本的設計保留 90% 寬度 */
    height: 80vh;
    margin: 0 auto;
    background: #000;
    overflow: hidden;
}

.hero-image {
    width: 100%;
    height: 100%;
    /* 🌟 關鍵：確保圖片填滿容器且不變形 */
    object-fit: cover; 
    /* 🌟 關鍵：圖片對齊中心 */
    object-position: center; 
    display: block;
    opacity: 0.9;
    /* 如果你希望保留原本稍微放大的視覺感，可以加上這行 */
    transform: scale(1.05); 
}

.philosophy-section {
    padding: 6rem 5%;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.philosophy-section h2 {
    font-family: var(--font-serif);
    font-size: 2rem;
    margin-bottom: 2rem;
    font-weight: normal;
    line-height: 1.4;
}

.philosophy-section p {
    font-family: var(--font-sans);
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 3rem;
    line-height: 1.8;
}

.cta-btn {
    display: inline-block;
    padding: 12px 30px;
    border: 1px solid #1a1a1a;
    color: #1a1a1a;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    transition: 0.3s;
}

.cta-btn:hover { background: #1a1a1a; color: #fff; }

/* --- 4. 平面作品集網格 --- */
.page-title {
    text-align: center;
    font-family: var(--font-serif);
    font-size: 2.5rem;
    margin: 2rem 0 3rem 0;
    font-weight: normal;
}

.gallery, .gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 30px;
    padding: 0 5% 5rem 5%;
}

.gallery-item {
    display: block; /* 確保 <a> 標籤填滿容器 */
    position: relative;
    aspect-ratio: 3 / 2; /* 攝影作品常用比例 */
    overflow: hidden;
    background: #000;
    border-radius: 0 !important; /* 嚴格執行方角 */
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 1.2s cubic-bezier(0.15, 0, 0.15, 1);
}

.gallery-item:hover img {
    transform: scale(1.05); /* 緩慢優雅的放大效果 */
}

/* 懸浮標題資訊 */
.item-info {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%;
    padding: 25px;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
    color: #fff;
    opacity: 0;
    transition: opacity 0.4s ease;
}

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

.item-title {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 400; /* 使用細體字增加質感 */
    letter-spacing: 1.5px;
}

/* 詳情頁專用樣式 */
#photo-detail-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px; /* 照片之間的間距 */
    padding: 2rem 5%;
    max-width: 1200px;
    margin: 0 auto;
}

.detail-item {
    width: 100%;
    background: none !important;
}

.detail-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    /* 加入淡淡的載入動畫 */
    animation: imgFadeIn 1.5s ease;
}

@keyframes imgFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- 6. 客戶推薦 & 聯絡 (這部分恢復原始狀態，不進入網格) --- */
.testimonials-section {
    padding: 5rem 5%;
    background: #fff;
    text-align: center;
}

.testimonials-section h2 {
    font-family: var(--font-serif);
    font-size: 2rem;
    margin-bottom: 3rem;
    font-weight: normal;
}

.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

.testimonial-item blockquote {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-style: italic;
    color: #555;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.testimonial-item cite {
    display: block;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #999;
    font-style: normal;
}

.contact-container {
    max-width: 900px;
    margin: 4rem auto;
    padding: 0 5%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
}

.contact-info h2 {
    font-family: var(--font-serif);
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.contact-info p {
    margin-bottom: 1rem;
    color: #555;
}

.contact-info a {
    border-bottom: 1px solid #ccc;
    padding-bottom: 2px;
}

.contact-info a:hover {
    color: #000;
    border-bottom-color: #000;
}

.process-list {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f9f9f9;
    border-left: 3px solid #1a1a1a;
}

.process-list h3 {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #333;
}

.process-list ol {
    list-style: none;
    counter-reset: process-counter;
}

.process-list li {
    position: relative;
    padding-left: 2rem;
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
    color: #555;
}

.process-list li::before {
    counter-increment: process-counter;
    content: counter(process-counter) ".";
    position: absolute;
    left: 0;
    font-weight: bold;
    color: #1a1a1a;
}

.process-list strong {
    color: #000;
    margin-right: 5px;
}

/* 表單樣式 */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    color: #888;
}

.form-group input, .form-group textarea {
    width: 100%; padding: 10px 0; border: none;
    border-bottom: 1px solid #ccc;
    background: transparent; outline: none; transition: 0.3s;
    background: transparent;
    font-family: var(--font-sans);
    font-size: 1rem;
    outline: none;
    transition: 0.3s;
}

.form-group input:focus, .form-group textarea:focus { border-bottom-color: #000; }

.submit-btn {
    padding: 10px 30px; background: #1a1a1a; color: #fff;
    border: none; text-transform: uppercase; cursor: pointer;
    transition: 0.3s; margin-top: 1rem;
}

/* --- 7. Footer --- */
footer {
    text-align: center;
    padding: 3rem 0;
    font-size: 0.8rem;
    color: #888;
    border-top: 1px solid #e0e0e0;
}

/* 作品詳情頁專用：不強制 16:9 或 3:2，保留照片原始比例 */
#photo-detail-grid {
    display: flex;
    flex-direction: column; /* 讓照片像瀑布流一樣一張一張垂直排下去，很有電影感 */
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

#photo-detail-grid .gallery-item {
    aspect-ratio: auto;
    background: none;
}

#photo-detail-grid img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* --- 8. 手機響應式優化 --- */
@media (max-width: 768px) {
    header {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        padding: 1rem 5%;
        gap: 0.5rem 1rem;
        background: rgba(245, 245, 245, 0.86);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }
    .menu-toggle { display: inline-block; justify-self: end; align-self: center; }
    nav { width: 100%; grid-column: 1 / -1; }
    nav ul {
        display: none;
        flex-direction: column;
        gap: 0.65rem;
        margin-top: 0.5rem;
    }
    nav.open ul { display: flex; }
    nav a { font-size: 0.85rem; }
    .hero-container {width: 100%;height: 60vh;}
    .hero-image {transform: none; /* 手機版通常不需要放大 */}
    .video-bg { object-fit: cover; transform: none; }
    .gallery, .gallery-grid { grid-template-columns: 1fr; padding: 0 5% 3rem 5%; }
    .contact-container { grid-template-columns: 1fr; gap: 2rem; }
}

/* 🌟 Iframe 修正 */
.lightbox-content iframe {
    position: absolute;
    top: 50%; left: 50%;
    width: 100%; height: 100%;
    transform: translate(-50%, -50%);
    object-fit: cover;
}

/* --- 9. Admin --- */
.admin-page {
    max-width: 1100px;
    margin: 2rem auto 4rem;
    padding: 0 5%;
    display: grid;
    gap: 2rem;
}

.admin-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    padding: 1.5rem;
}

.admin-note {
    color: #666;
    margin-top: 0.25rem;
}

.admin-top-actions {
    margin-top: 0.75rem;
    margin-bottom: 1rem;
}

.admin-top-actions button {
    border: 1px solid #bcbcbc;
    background: #fff;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
}

.admin-form {
    margin-top: 1.25rem;
    display: grid;
    gap: 1rem;
}

.field label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
    color: #555;
}

.field input,
.field select {
    width: 100%;
    border: 1px solid #cfcfcf;
    padding: 0.65rem 0.8rem;
    font-family: var(--font-sans);
    background: #fff;
}

.admin-status {
    min-height: 1.5rem;
    margin: 0.5rem 0 1rem;
    font-size: 0.95rem;
}

.admin-status.ok {
    color: #1a5f2f;
}

.admin-status.error {
    color: #9f1d1d;
}

.task-progress {
    margin: 0 0 1rem;
}

.task-progress-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 0.4rem;
}

.task-progress-track {
    width: 100%;
    height: 8px;
    background: #e8e8e8;
    border-radius: 999px;
    overflow: hidden;
}

.task-progress-bar {
    width: 0%;
    height: 100%;
    background: #1a1a1a;
    transition: width 0.2s ease;
}

.task-progress.error .task-progress-bar {
    background: #9f1d1d;
}

.admin-list {
    display: grid;
    gap: 1rem;
}

.admin-home-cover {
    width: 100%;
    max-height: 320px;
    object-fit: cover;
    background: #111;
    margin: 1rem 0;
}

.admin-item {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1rem;
    border: 1px solid #ececec;
    padding: 0.8rem;
    align-items: start;
}

.admin-item img {
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    background: #111;
}

.admin-item-fields {
    display: grid;
    gap: 0.8rem;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.admin-actions button {
    border: 1px solid #bcbcbc;
    background: #fff;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
}

.admin-actions .save-btn {
    border-color: #1a1a1a;
}

.admin-actions .delete-btn {
    border-color: #8f2020;
    color: #8f2020;
}

@media (max-width: 768px) {
    .admin-item {
        grid-template-columns: 1fr;
    }
}

.login-page {
    max-width: 520px;
    margin: 3rem auto 5rem;
    padding: 0 5%;
}

.login-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    padding: 1.5rem;
}
