/* 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;
}

/* --- 3. 首頁影片與品牌理念 (維持原樣) --- */
.hero-container {
    position: relative;
    width: 90%;
    height: 80vh;
    margin: 0 auto;
    background: #000;
    overflow: hidden;
}

.video-bg {
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none;
    opacity: 0.9;
    transform: scale(1.2);
}

.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. 作品集列表 (Gallery) --- */
.page-title {
    text-align: center;
    font-family: var(--font-serif);
    font-size: 2.5rem;
    margin: 2rem 0 3rem 0;
    font-weight: normal;
}

/* 🌟 關鍵修復：讓動態生成的 .gallery-grid 直接套用原本 .gallery 的設定 */
.gallery, .gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 30px;
    padding: 0 5% 5rem 5%;
}

.gallery-item {
    position: relative;
    cursor: pointer;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #ddd;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
    display: block;
}

.gallery-item:hover img {
    transform: scale(1.05);
    opacity: 0.9;
}

.play-icon {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 50px; height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    opacity: 0;
    transition: 0.3s;
}

.play-icon::after {
    content: '';
    position: absolute;
    top: 16px; left: 20px;
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    border-left: 14px solid #333;
}

.gallery-item:hover .play-icon { opacity: 1; }

.item-info {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; padding: 20px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: #fff;
    opacity: 0;
    transition: 0.3s;
}

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

.item-title { font-family: var(--font-serif); font-size: 1.2rem; }

/* --- 5. 燈箱 (Lightbox) --- */
.lightbox {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999;
    display: flex; justify-content: center; align-items: center;
    opacity: 0; pointer-events: none; transition: opacity 0.3s;
}

.lightbox.active { opacity: 1; pointer-events: all; }

.lightbox-content {
    width: 80%;
    max-width: 1000px;
    aspect-ratio: 16/9;
    position: relative;
    background: #000;
    overflow: hidden;
}

.close-btn {
    position: absolute; top: -40px; right: 0;
    color: #fff; font-size: 2rem; cursor: pointer;
}

/* --- 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;
}

/* --- 8. 手機響應式優化 --- */
@media (max-width: 768px) {
    header { flex-direction: column; align-items: flex-start; padding: 1rem 5%; gap: 0.5rem; }
    nav ul { gap: 1rem; font-size: 0.8rem; }
    .hero-container { width: 100%; height: 60vh; margin: 0; }
    .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: 1200px;
    margin: 2rem auto 5rem;
    padding: 0 5%;
}

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

.admin-card h2 {
    font-family: var(--font-serif);
    font-weight: 400;
    margin-bottom: 1rem;
}

.admin-form {
    display: grid;
    grid-template-columns: 2fr 1.2fr 1fr auto;
    gap: 0.8rem;
}

.admin-form input,
.admin-form select,
.admin-form button {
    padding: 0.6rem 0.7rem;
    border: 1px solid #ccc;
    background: #fff;
}

.admin-form button {
    background: #111;
    color: #fff;
    cursor: pointer;
}

.admin-status {
    margin-top: 0.8rem;
    color: #2f6f3e;
}

.admin-status.error {
    color: #a42323;
}

.admin-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.admin-work-row {
    display: grid;
    grid-template-columns: 55px 2fr 1.2fr 120px auto;
    gap: 0.6rem;
    align-items: center;
}

.admin-order {
    font-size: 0.9rem;
    color: #555;
}

.admin-input {
    width: 100%;
    border: 1px solid #ccc;
    padding: 0.5rem 0.6rem;
    background: #fff;
}

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

.admin-actions button {
    border: 1px solid #ccc;
    background: #fff;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
}

.admin-actions .danger {
    border-color: #d85e5e;
    color: #b52828;
}

.admin-empty {
    color: #777;
    font-size: 0.95rem;
}

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

    .admin-work-row {
        grid-template-columns: 1fr;
        border: 1px solid #ececec;
        padding: 0.8rem;
    }

    .admin-order {
        margin-bottom: -0.2rem;
    }
}

.hidden {
    display: none;
}

.admin-login-card {
    max-width: 520px;
    margin: 0 auto 1.5rem;
}

.admin-login-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
}

.admin-login-form input,
.admin-login-form button {
    padding: 0.65rem 0.7rem;
    border: 1px solid #ccc;
}

.admin-login-form button {
    background: #111;
    color: #fff;
    cursor: pointer;
}

.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.admin-user {
    margin-right: 0.8rem;
    color: #555;
}

.admin-logout-btn {
    border: 1px solid #ccc;
    background: #fff;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
}
