/* ==========================================================================
   WeTech Blog — 共用樣式
   沿用 index_zh-TW.html 的 design tokens（深色主題 + Inter），
   額外加入文章排版（prose）、列表卡片、breadcrumb、相關文章、CTA。
   ========================================================================== */

/* ===== Design Tokens ===== */
:root {
    --bg-primary: #0d0d0d;
    --bg-secondary: #161616;
    --bg-card: #141414;
    --accent-white: #ffffff;
    --accent-gray: #a0a0a0;
    --accent-cyan: #5eead4;      /* 主頁引用但未定義，於此補上得體 accent */
    --accent-link: #7cc4ff;
    --text-primary: #f0f0f0;
    --text-secondary: #999999;
    --white: #ffffff;
    --border-soft: rgba(136, 146, 176, 0.2);
    --header-bg: rgba(10, 25, 47, 0.95);
    --transition: all 0.3s ease;
    --measure: 46rem;            /* 文章可讀行寬 */
}

/* ===== Reset & Base ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
}
a { text-decoration: none; color: inherit; transition: var(--transition); }
ul { list-style: none; }
img { max-width: 100%; height: auto; }

/* ===== Utility ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.btn {
    display: inline-block; padding: 14px 32px; border-radius: 8px;
    font-weight: 600; font-size: 1rem; cursor: pointer;
    transition: var(--transition); border: none;
}
.btn-primary {
    background: var(--white); color: #000; font-weight: 700; border: 2px solid var(--white);
}
.btn-primary:hover {
    background: #000; color: var(--white); border-color: var(--white);
    transform: translateY(-2px); box-shadow: 0 10px 30px rgba(255, 255, 255, 0.2);
}
.btn-outline { background: transparent; border: 2px solid rgba(255, 255, 255, 0.5); color: var(--white); }
.btn-outline:hover { border-color: var(--white); background: rgba(255, 255, 255, 0.1); }
.btn-full { width: 100%; }

/* ===== Header & Nav（沿用主頁外觀）===== */
header {
    position: fixed; top: 0; left: 0; width: 100%; z-index: 1000;
    background: var(--header-bg); backdrop-filter: blur(10px); transition: var(--transition);
}
header.scrolled { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); }
nav { display: flex; justify-content: space-between; align-items: center; padding: 1rem 0; }
.logo { font-size: 1.5rem; font-weight: 700; color: var(--white); }
.logo span { color: var(--accent-cyan); }
.nav-links { display: flex; align-items: center; gap: 2rem; }
.nav-links a { color: var(--text-primary); font-weight: 500; position: relative; }
.nav-links a::after {
    content: ''; position: absolute; bottom: -5px; left: 0; width: 0; height: 2px;
    background: var(--white); transition: var(--transition);
}
.nav-links a:hover { color: var(--white); }
.nav-links a:hover::after { width: 100%; }
.nav-links a.active { color: var(--white); }
.nav-cta { margin-left: 0.5rem; }
.lang-switcher select {
    background: transparent; border: 1px solid rgba(255, 255, 255, 0.3); color: var(--text-primary);
    padding: 6px 10px; border-radius: 6px; font-size: 0.9rem; cursor: pointer; transition: var(--transition);
}
.lang-switcher select:hover { border-color: var(--white); }
.lang-switcher select option { background: var(--bg-primary); color: var(--text-primary); }

.hamburger { display: none; flex-direction: column; gap: 5px; cursor: pointer; }
.hamburger span { width: 25px; height: 2px; background: var(--white); transition: var(--transition); }

/* ===== Page shell ===== */
.page { padding-top: 90px; }
.breadcrumb { font-size: 0.9rem; color: var(--text-secondary); padding: 1.5rem 0 0.5rem; }
.breadcrumb a:hover { color: var(--white); }
.breadcrumb span { color: var(--text-secondary); margin: 0 0.4rem; }

/* ===== Article ===== */
.article { max-width: var(--measure); margin: 0 auto; padding: 1rem 20px 4rem; }
.article-header { padding: 1.5rem 0 2rem; border-bottom: 1px solid var(--border-soft); margin-bottom: 2.5rem; }
.article-category {
    display: inline-block; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.05em;
    text-transform: uppercase; color: var(--accent-cyan); margin-bottom: 1rem;
}
.article h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); font-weight: 700; line-height: 1.25; color: var(--white); margin-bottom: 1.2rem; }
.article-meta { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.9rem; color: var(--text-secondary); }
.article-meta .sep { opacity: 0.5; }

/* prose */
.prose { font-size: 1.075rem; color: var(--text-primary); }
.prose > p { margin: 0 0 1.4rem; }
.prose .lead { font-size: 1.2rem; color: var(--accent-gray); margin-bottom: 2rem; }
.prose h2 {
    font-size: 1.7rem; font-weight: 700; color: var(--white);
    margin: 2.8rem 0 1rem; padding-top: 0.5rem; line-height: 1.3;
}
.prose h3 { font-size: 1.3rem; font-weight: 600; color: var(--white); margin: 2rem 0 0.8rem; }
.prose ul, .prose ol { margin: 0 0 1.4rem 1.4rem; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin-bottom: 0.6rem; padding-left: 0.3rem; }
.prose a { color: var(--accent-link); text-decoration: underline; text-underline-offset: 3px; }
.prose a:hover { color: var(--white); }
.prose strong { color: var(--white); font-weight: 600; }
.prose blockquote {
    border-left: 3px solid var(--accent-cyan); background: var(--bg-secondary);
    padding: 1rem 1.5rem; margin: 0 0 1.6rem; border-radius: 0 8px 8px 0; color: var(--accent-gray);
}
.prose code {
    background: var(--bg-secondary); padding: 0.15em 0.45em; border-radius: 5px;
    font-size: 0.9em; font-family: 'SFMono-Regular', Consolas, monospace; color: #e6e6e6;
}
.prose pre {
    background: var(--bg-secondary); border: 1px solid var(--border-soft); border-radius: 8px;
    padding: 1.2rem; overflow-x: auto; margin: 0 0 1.6rem;
}
.prose pre code { background: none; padding: 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 1.6rem; font-size: 0.98rem; }
.prose th, .prose td { border: 1px solid var(--border-soft); padding: 0.7rem 0.9rem; text-align: left; }
.prose th { background: var(--bg-secondary); color: var(--white); font-weight: 600; }
.prose figure { margin: 0 0 1.6rem; }
.prose figcaption { font-size: 0.85rem; color: var(--text-secondary); text-align: center; margin-top: 0.5rem; }

/* key-takeaway / callout box */
.callout {
    background: var(--bg-secondary); border: 1px solid var(--border-soft); border-radius: 10px;
    padding: 1.4rem 1.6rem; margin: 0 0 1.8rem;
}
.callout h4 { color: var(--white); margin-bottom: 0.7rem; font-size: 1.05rem; }
.callout ul { margin-bottom: 0; }

/* ===== In-article ad slot ===== */
.ad-slot { margin: 2.5rem 0; min-height: 90px; text-align: center; }
.ad-slot small { display: block; font-size: 0.7rem; color: var(--text-secondary); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 0.4rem; }

/* ===== CTA box ===== */
.article-cta {
    margin: 3rem 0 0; padding: 2rem; border-radius: 12px;
    background: linear-gradient(135deg, #161616 0%, #1f1f1f 100%);
    border: 1px solid var(--border-soft); text-align: center;
}
.article-cta h3 { color: var(--white); margin-bottom: 0.6rem; }
.article-cta p { color: var(--text-secondary); margin-bottom: 1.4rem; }

/* ===== Related articles ===== */
.related { max-width: var(--measure); margin: 0 auto; padding: 2.5rem 20px 4rem; border-top: 1px solid var(--border-soft); }
.related h3 { color: var(--white); margin-bottom: 1.5rem; font-size: 1.3rem; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.2rem; }
.related-card {
    background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 10px;
    padding: 1.3rem; transition: var(--transition);
}
.related-card:hover { transform: translateY(-4px); border-color: rgba(255,255,255,0.25); }
.related-card .cat { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent-cyan); }
.related-card h4 { color: var(--white); margin: 0.5rem 0; font-size: 1.05rem; line-height: 1.4; }

/* ===== Blog index ===== */
.blog-hero { padding: 3rem 0 1rem; text-align: center; }
.blog-hero h1 { font-size: clamp(2rem, 5vw, 3rem); color: var(--white); margin-bottom: 1rem; }
.blog-hero p { color: var(--text-secondary); max-width: 640px; margin: 0 auto; }
.blog-filters { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; margin: 2rem 0; }
.blog-filters .pill {
    font-size: 0.85rem; padding: 0.45rem 1.1rem; border-radius: 999px;
    border: 1px solid var(--border-soft); color: var(--text-secondary);
    background: transparent; font-family: inherit; cursor: pointer; transition: var(--transition);
}
.blog-filters .pill:hover { color: var(--white); border-color: rgba(255, 255, 255, 0.5); }
.blog-filters .pill.active { background: var(--white); color: #000; border-color: var(--white); font-weight: 600; }
.post-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem; padding: 1rem 0 4rem;
}
.post-card {
    background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 12px;
    padding: 1.6rem; display: flex; flex-direction: column; transition: var(--transition);
}
.post-card:hover { transform: translateY(-5px); border-color: rgba(255,255,255,0.25); box-shadow: 0 15px 40px rgba(0,0,0,0.3); }
.post-card .cat { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent-cyan); margin-bottom: 0.6rem; }
.post-card h2 { font-size: 1.2rem; color: var(--white); line-height: 1.4; margin-bottom: 0.7rem; }
.post-card p { color: var(--text-secondary); font-size: 0.95rem; flex-grow: 1; margin-bottom: 1rem; }
.post-card .post-meta { font-size: 0.82rem; color: var(--text-secondary); }
.post-card .read-more { color: var(--white); font-weight: 600; font-size: 0.9rem; margin-top: 0.8rem; }
.post-card .read-more::after { content: ' →'; }

/* ===== Supporting pages (about / contact / faq) ===== */
.page-hero { padding: 3rem 0 1.5rem; text-align: center; }
.page-hero h1 { font-size: clamp(2rem, 5vw, 3rem); color: var(--white); margin-bottom: 1rem; }
.page-hero p { color: var(--text-secondary); max-width: 660px; margin: 0 auto; }
.content { max-width: var(--measure); margin: 0 auto; padding: 1rem 20px 3rem; }

/* contact */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; max-width: 1000px; margin: 0 auto; padding: 1rem 20px 4rem; }
.contact-info .info-item { margin-bottom: 1.6rem; }
.contact-info .info-item h4 { color: var(--white); margin-bottom: 0.3rem; }
.contact-info .info-item p, .contact-info .info-item a { color: var(--text-secondary); }
.contact-info .info-item a:hover { color: var(--white); }
.contact-form label { display: block; color: var(--text-primary); font-size: 0.9rem; margin: 0 0 0.4rem; }
.contact-form input, .contact-form select, .contact-form textarea {
    width: 100%; padding: 0.75rem 0.9rem; margin-bottom: 1.1rem; border-radius: 8px;
    background: var(--bg-secondary); border: 1px solid var(--border-soft); color: var(--text-primary);
    font-family: inherit; font-size: 0.95rem;
}
.contact-form textarea { min-height: 130px; resize: vertical; }
.contact-form input:focus, .contact-form select:focus, .contact-form textarea:focus { outline: none; border-color: rgba(255, 255, 255, 0.5); }
.form-note { font-size: 0.82rem; color: var(--text-secondary); margin-top: 0.6rem; }

/* faq */
.faq-list { max-width: var(--measure); margin: 0 auto; padding: 1rem 20px 4rem; }
.faq-item { border: 1px solid var(--border-soft); border-radius: 10px; margin-bottom: 1rem; background: var(--bg-card); overflow: hidden; }
.faq-item summary { padding: 1.1rem 3rem 1.1rem 1.4rem; color: var(--white); font-weight: 600; cursor: pointer; list-style: none; position: relative; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; position: absolute; right: 1.4rem; top: 1rem; color: var(--accent-cyan); font-size: 1.4rem; }
.faq-item[open] summary::after { content: '\2212'; }
.faq-item .faq-a { padding: 0 1.4rem 1.2rem; color: var(--text-secondary); }
.faq-item .faq-a a { color: var(--accent-link); text-decoration: underline; }

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

/* ===== Footer（沿用主頁）===== */
footer { background: var(--bg-primary); padding: 4rem 0 2rem; border-top: 1px solid var(--border-soft); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 3rem; margin-bottom: 3rem; }
.footer-brand p { color: var(--text-secondary); margin: 1rem 0; }
.social-links { display: flex; gap: 1rem; }
.social-links a {
    width: 40px; height: 40px; background: var(--bg-secondary); border-radius: 50%;
    display: flex; align-items: center; justify-content: center; color: var(--text-primary);
}
.social-links a:hover { background: var(--accent-cyan); color: var(--bg-primary); }
.footer-links h4 { color: var(--white); margin-bottom: 1.5rem; }
.footer-links ul li { margin-bottom: 0.75rem; }
.footer-links a { color: var(--text-secondary); }
.footer-links a:hover { color: var(--white); }
.footer-bottom { text-align: center; padding-top: 2rem; border-top: 1px solid var(--border-soft); color: var(--text-secondary); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .nav-links.open {
        display: flex; flex-direction: column; align-items: flex-start;
        position: absolute; top: 100%; left: 0; right: 0;
        background: var(--header-bg); backdrop-filter: blur(10px);
        padding: 1.2rem 20px; gap: 1.2rem; border-top: 1px solid var(--border-soft);
    }
    .hamburger { display: flex; }
    .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
    .article { padding-top: 0.5rem; }
    .prose { font-size: 1.02rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; scroll-behavior: auto !important; }
    .post-card:hover, .related-card:hover { transform: none; }
}
