/* ============================================================
   文章 & 案例詳細頁專屬樣式（BEM 命名）
   ============================================================ */

/* ===== Hero（文章詳細頁版） ===== */
.hero--post {
    background: linear-gradient(135deg, var(--hero-dark) 30%, #1e3a8a);
    color: #fff;
    text-align: center;
}
.hero--post .hero__inner {
    max-width: 800px;
    margin: 0 auto;
}
.hero__tag {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    color: #93c5fd;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 20px;
}
.hero__tag i {
    margin-right: 4px;
}
.hero--post .hero__title {
    font-size: 42px;
    line-height: 1.3;
    margin-bottom: 20px;
    font-weight: 700;
    color: #fff;
}
.hero__meta {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 15px;
    color: #cbd5e1;
    flex-wrap: wrap;
}
.hero__meta i {
    margin-right: 6px;
}

/* ===== 文章詳細佈局 ===== */
.detail__layout {
    max-width: 1200px;
    margin: -60px auto 60px;
    padding: 0 20px;
    display: flex;
    gap: 40px;
    align-items: flex-start;
    position: relative;
    z-index: 10;
}

/* ===== 主內容區 ===== */
.detail__main {
    flex: 2.5;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}
.detail__main p {
    font-size: 16px;
    line-height: 1.4;
    color: #475569;
    margin-bottom: 4px;
}

/* 程式碼區塊 */
.detail__code {
    background: #1e293b;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 10px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    margin: 20px 0;
    overflow-x: auto;
    position: relative;
    line-height: 1.6;
}
.detail__code::before {
    content: attr(data-lang);
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 12px;
    color: #64748b;
    font-family: 'Segoe UI', sans-serif;
}
.detail__code .comment { color: #94a3b8; font-style: italic; }
.detail__code .keyword { color: #c084fc; }
.detail__code .string { color: #fde047; }
.detail__code .func { color: #60a5fa; }

/* 上下篇文章導覽 */
.detail__nav {
    display: flex;
    justify-content: space-between;
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}
.detail__nav-link {
    text-decoration: none;
    color: var(--btn-blue);
    font-weight: bold;
    font-size: 0.9rem;
    transition: 0.2s;
}
.detail__nav-link:hover {
    color: var(--primary-blue);
    text-decoration: underline;
}

/* ===== 側邊欄 ===== */
.detail__sidebar {
    flex: 1;
    min-width: 280px;
}
.sidebar__card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}
.sidebar__title {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--text-dark);
    border-bottom: 2px solid var(--bg-light-blue);
    padding-bottom: 10px;
}
.sidebar__title i {
    margin-right: 8px;
}
.sidebar__list {
    list-style: none;
}
.sidebar__list li {
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}
.sidebar__list li:last-child {
    border-bottom: none;
}
.sidebar__list a {
    text-decoration: none;
    color: var(--text-gray);
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar__list a:hover {
    color: var(--btn-blue);
}
.sidebar__list a i {
    font-size: 12px;
    color: #94a3b8;
}

/* 標籤雲 */
.sidebar__tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.sidebar__tag-cloud a {
    background: var(--bg-light-blue);
    color: var(--btn-blue);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
    transition: 0.2s;
}
.sidebar__tag-cloud a:hover {
    background: var(--btn-blue);
    color: #fff;
}

/* 側邊欄 CTA 卡片 */
.sidebar__card--cta {
    background: var(--bg-light-blue);
    border: 1px solid #bfdbfe;
    text-align: center;
}
.sidebar__card--cta .sidebar__title {
    border-bottom: none;
    color: var(--btn-blue);
}
.sidebar__card--cta p {
    font-size: 14px;
    color: var(--text-gray);
    margin-bottom: 15px;
}
.sidebar__card--cta .btn {
    display: block;
    width: 100%;
    text-align: center;
    background: var(--btn-blue);
    color: #fff;
    padding: 10px 0;
    border-radius: 5px;
    font-weight: bold;
    text-decoration: none;
    font-size: 14px;
    transition: 0.2s;
}
.sidebar__card--cta .btn:hover {
    background: var(--btn-blue-hover);
}

/* ===== 響應式 ===== */
@media (max-width: 992px) {
    .detail__layout {
        flex-direction: column;
    }
    .detail__sidebar {
        width: 100%;
    }
}
@media (max-width: 768px) {
    .hero--post {
        padding: 60px 20px 80px;
    }
    .hero--post .hero__title {
        font-size: 28px;
    }
    .hero__meta {
        flex-direction: column;
        gap: 8px;
    }
    .detail__main {
        padding: 20px;
    }
}

/* ============================================================
   案例詳細頁樣式（BEM 命名）
   ============================================================ */

/* ===== 詳細容器 ===== */
.detail__back-link {
    display: inline-flex;
    gap: 8px;
    color: var(--btn-blue);
    text-decoration: none;
    font-size: 13px;
    margin-bottom: 18px;
}
.detail__header { margin-bottom: 28px; }
.detail__header h1 {
    margin: 0;
    font-size: 36px;
    letter-spacing: -0.03em;
    color: var(--text-dark);
    line-height: 1.2;
}
.detail__header p {
    margin: 10px 0 0;
    color: var(--text-gray);
    font-size: 13px;
}

/* ===== 第一區：左 9:16 預覽 / 右快速資訊 ===== */
.detail__preview {
    display: grid;
    grid-template-columns: minmax(280px, 430px) minmax(340px, 1fr);
    gap: clamp(45px, 7vw, 100px);
    align-items: start;
    margin-bottom: 72px;
}
.detail__media { display: flex; flex-direction: column; align-items: center; }
.detail__gallery {
    width: min(100%, 390px);
    aspect-ratio: 9 / 16;
    background: #e5e7eb;
    overflow: hidden;
    position: relative;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.13);
    border-radius: 6px;
}
.detail__gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail__gallery-badge {
    position: absolute;
    left: 14px;
    bottom: 14px;
    background: rgba(15, 23, 42, 0.78);
    color: #fff;
    padding: 7px 11px;
    border-radius: 5px;
    font-size: 11px;
}
.detail__thumbs {
    width: min(100%, 390px);
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 14px;
}
.detail__thumbs-scroll {
    display: flex;
    gap: 8px;
    overflow: auto;
    scrollbar-width: none;
    flex: 1;
    padding: 2px;
}
.detail__thumbs-scroll::-webkit-scrollbar { display: none; }
.detail__thumbs-item {
    flex: 0 0 54px;
    width: 54px;
    height: 54px;
    border-radius: 5px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    background: #e2e8f0;
}
.detail__thumbs-item--active { border-color: var(--btn-blue); }
.detail__thumbs-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail__thumbs-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-light);
    background: #fff;
    color: var(--text-gray);
    border-radius: 50%;
    cursor: pointer;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== 右側快速資訊 ===== */
.detail__info { display: flex; flex-direction: column; gap: 14px; }
.detail__kicker {
    font-size: 10px;
    letter-spacing: 0.16em;
    color: var(--text-gray);
    font-weight: 700;
    margin-bottom: 7px;
}
.detail__info-title { font-size: 27px; margin: 0 0 6px; color: var(--text-dark); line-height: 1.3; }
.detail__info-intro { color: var(--text-gray); font-size: 14px; line-height: 1.75; margin: 0 0 12px; }
.detail__card {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 20px 22px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.035);
}
.detail__card h3 {
    font-size: 15px;
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dark);
}
.detail__card h3 i { color: var(--btn-blue); }
.detail__info-list { display: grid; gap: 0; }
.detail__info-row {
    display: flex;
    justify-content: space-between;
    gap: 25px;
    padding: 9px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}
.detail__info-row:last-child { border-bottom: 0; padding-bottom: 0; }
.detail__info-key { color: var(--text-gray); }
.detail__info-value { text-align: right; font-weight: 600; color: var(--text-dark); }
.detail__cta-text { font-size: 13px; color: var(--text-gray); line-height: 1.7; margin: 0 0 14px; }
.detail__btn-row { display: grid; gap: 9px; }
.detail__btn {
    display: block;
    text-align: center;
    padding: 11px;
    border-radius: 7px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}
.detail__btn--primary { background: var(--btn-blue); color: #fff; }
.detail__btn--secondary { border: 1px solid var(--border-light); color: var(--text-gray); background: var(--card-bg); }
.detail__share-row { display: flex; gap: 14px; }
.detail__share-row a { font-size: 19px; color: var(--text-gray); text-decoration: none; }
.detail__share-row a:hover { color: var(--btn-blue); }

/* ===== 第二區：長內容單欄 ===== */
.detail__long { display: grid; gap: 20px; }
.detail__long-card {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 30px 34px;
    box-shadow: 0 2px 9px rgba(15, 23, 42, 0.035);
}
.detail__long-card h2 {
    font-size: 20px;
    margin: 0 0 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-dark);
}
.detail__long-card h2 i { color: var(--btn-blue); }
.detail__long-card p,
.detail__long-card li { font-size: 14px; line-height: 1.6; color: #334155; }
.detail__long-card p { margin: 0 0 4px; }
.detail__long-card p:last-child { margin-bottom: 0; }
.detail__challenge-list { display: grid; gap: 15px; margin: 0; padding: 0; list-style: none; }
.detail__challenge-item {
    padding: 16px 18px;
    background: #f8fafc;
    border-left: 3px solid #93c5fd;
    border-radius: 4px;
}
.detail__challenge-item strong { color: var(--text-dark); }
.detail__solution { display: block; margin-top: 5px; color: var(--primary-blue); font-size: 13px; }

/* ===== 響應式 ===== */
@media (max-width: 800px) {
    .detail__preview { grid-template-columns: 1fr; gap: 35px; margin-bottom: 45px; }
    .detail__media { align-items: center; }
    .detail__info { width: 100%; }
    .detail__header h1 { font-size: 29px; }
}
@media (max-width: 600px) {
    .detail__gallery { width: min(100%, 330px); }
    .detail__thumbs { width: min(100%, 330px); }
    .detail__long-card { padding: 23px 20px; }
    .detail__info-row { font-size: 12px; }
}

/* ===== 麵包屑 ===== */
/* ===== 返回連結 ===== */
.detail__back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--btn-blue);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 20px;
    transition: 0.2s;
}
.detail__back-link:hover {
    gap: 12px;
    color: var(--primary-blue);
}

/* ===== 返回連結 + 上一篇/下一篇 ===== */
.detail__topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.detail__topbar .detail__back-link {
    margin-bottom: 0;
}
/* 標題卡片式上下篇導覽（topbar / downloadbar 右側用，不與 .detail__nav 衝突） */
.detail__title-nav {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.detail__title-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 260px;
    padding: 9px 13px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-dark);
    text-decoration: none;
    transition: 0.2s;
}
.detail__title-nav-link:hover {
    border-color: var(--btn-blue);
    color: var(--btn-blue);
}
.detail__title-nav-link i {
    font-size: 12px;
    color: var(--btn-blue);
}
.detail__title-nav-label {
    color: var(--text-gray);
    font-size: 11px;
    white-space: nowrap;
}
.detail__title-nav-title {
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.detail__downloadbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

/* ===== 專案標題 ===== */
.detail__project-title {
    font-size: 36px;
    color: var(--text-dark);
    line-height: 1.2;
    margin-bottom: 30px;
}

/* ===== 圖片預覽卡片 ===== */
.gallery {
    background: #0f172a;
    border-radius: 16px;
    padding: 30px 30px 20px;
    margin-bottom: 40px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}
.gallery__main {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background: #1e293b;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 18px;
}
.gallery__main img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gallery__badge {
    position: absolute;
    bottom: 16px;
    left: 16px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
.gallery__thumbs {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
}
.gallery__thumb-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 4px 0;
    flex: 1;
    &::-webkit-scrollbar { display: none; }
    -ms-overflow-style: none;
}
.gallery__thumb-scroll::-webkit-scrollbar {
    display: none;
}
.gallery__thumb {
    flex: 0 0 auto;
    width: 100px;
    height: 56px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border 0.2s, transform 0.2s;
    background: #1e293b;
}
.gallery__thumb:hover {
    border-color: #3b82f6;
    transform: scale(1.05);
}
.gallery__thumb--active {
    border-color: #fff;
}
.gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gallery__scroll-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    font-size: 16px;
}
.gallery__scroll-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}
.gallery__scroll-btn:disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* ===== 案例內容雙欄 ===== */
.detail__grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}

/* ===== 左欄區塊 ===== */
.detail__block {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 28px 32px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.detail__block h3 {
    font-size: 20px;
    color: var(--text-dark);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.detail__block h3 i {
    color: var(--btn-blue);
    font-size: 20px;
}
.detail__block p {
    font-size: 15px;
    line-height: 1.8;
    color: #334155;
    margin-bottom: 12px;
}
.detail__block ul {
    padding-left: 22px;
    margin: 12px 0;
}
.detail__block ul li {
    font-size: 15px;
    line-height: 1.8;
    color: #334155;
    margin-bottom: 6px;
}
.detail__block ul li strong {
    font-weight: 700;
    color: var(--text-dark);
}

/* ===== 右欄 ===== */
.detail__sidebar section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.detail__sidebar section h4 {
    font-size: 16px;
    color: var(--text-dark);
    margin-bottom: 14px;
    border-bottom: 2px solid var(--bg-light-blue);
    padding-bottom: 10px;
}

/* 專案資訊列 */
.case__info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    border-bottom: 1px solid #f1f5f9;
}
.case__info-row:last-child {
    border-bottom: none;
}
.case__info-key {
    color: var(--text-gray);
}
.case__info-value {
    font-weight: 500;
    color: var(--text-dark);
}

/* 側邊欄按鈕（使用 base.css 的 .btn--primary） */
.detail__sidebar .btn--primary {
    width: 90%;
    justify-content: center;
}
.detail__sidebar section {
    text-align: center;
}
.detail__sidebar .btn--outline {
    display: block;
    width: 100%;
    margin-top: 10px;
    background: transparent;
    border: 1px solid var(--border-light);
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-gray);
    font-weight: 500;
    transition: 0.2s;
}
.detail__sidebar .btn--outline:hover {
    border-color: var(--btn-blue);
    color: var(--btn-blue);
}

/* 分享 */
.share {
    display: flex;
    gap: 14px;
    font-size: 22px;
}
.share__link {
    color: var(--text-gray);
    transition: 0.2s;
}
.share__link:hover {
    transform: scale(1.1);
}

/* ===== 底部 CTA（共用，避免缺少 list page CSS） ===== */
.detail__cta {
    background: var(--hero-dark);
    color: #fff;
    text-align: center;
    padding: 60px 20px;
}
.detail__cta-title {
    font-size: 28px;
    margin-bottom: 15px;
    color: #dbeafe;
}
.detail__cta-desc {
    margin-bottom: 25px;
    color: #94a3b8;
    font-size: 1rem;
}
.detail__cta-btn {
    display: inline-block;
    background: var(--btn-blue);
    color: #fff;
    padding: 12px 40px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: bold;
    font-size: 16px;
    transition: 0.3s;
}
.detail__cta-btn:hover {
    background: #1d4ed8;
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.4);
}
.detail__cta-btn i {
    margin-left: 8px;
}

/* ===== 社群分享按鈕 ===== */
.detail__share-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 12px 0 12px;
    margin-bottom: 16px;
}
.detail__share-count {
    font-size: 12px;
    color: var(--text-gray);
}
.detail__share {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px 0;
    border-top: 1px solid var(--border-light);
    margin-top: 20px;
}
.detail__share-label {
    font-size: 12px;
    color: var(--text-gray);
    white-space: nowrap;
}
.detail__share-buttons {
    display: flex;
    gap: 8px;
}
.detail__share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    text-decoration: none;
    font-size: 11px;
    transition: 0.2s;
    color: #fff;
}
.detail__share-btn:hover {
    transform: scale(1.1);
    opacity: 0.85;
}
.detail__share-btn--fb {
    background: #1877f2;
}
.detail__share-btn--line {
    background: #06c755;
}
.detail__share-btn--tw {
    background: #000000;
}
.detail__share-btn--wx {
    background: #07c160;
}
.detail__share-btn--ig {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
}
.detail__share-btn--link {
    background: var(--text-gray);
}

/* ===== 響應式 ===== */
@media (max-width: 992px) {
    .detail__grid {
        grid-template-columns: 1fr;
    }
    .detail__project-title {
        font-size: 28px;
    }
    .gallery__thumb {
        width: 80px;
        height: 45px;
    }
}
@media (max-width: 600px) {
    .breadcrumb {
        padding: 12px 5%;
        font-size: 13px;
    }
    .detail__back-link {
        margin-bottom: 12px;
    }
    .gallery {
        padding: 16px;
    }
    .gallery__thumb {
        width: 60px;
        height: 34px;
    }
    .gallery__scroll-btn {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }
    .detail__block {
        padding: 20px;
    }
    .detail__sidebar section {
        padding: 18px 20px;
    }
}
