/* ============================================================
   Ask Reuben 繁體中文版 — 仿 4js.com 風格
   ============================================================ */

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

:root {
    --navy:       #1a3463;
    --navy-dark:  #112040;
    --blue:       #0070b8;
    --blue-light: #1a8fd1;
    --text:       #333333;
    --muted:      #666666;
    --bg:         #f4f6f8;
    --white:      #ffffff;
    --border:     #d8dde6;
    --code-bg:    #1e2a3a;
    --code-text:  #d4dae4;
}

body {
    font-family: "Noto Sans TC", "Microsoft JhengHei UI", "微軟正黑體", "PingFang TC", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.8;
    font-size: 15px;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-light); text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.container-narrow { max-width: 860px; margin: 0 auto; padding: 0 1.5rem; }

/* ====== TOP BAR ====== */
.top-bar {
    background: var(--navy-dark);
    padding: 0.35rem 0;
    font-size: 0.78rem;
}
.top-bar .container {
    display: flex;
    justify-content: flex-end;
    gap: 1.25rem;
}
.top-bar a { color: rgba(255,255,255,0.65); }
.top-bar a:hover { color: rgba(255,255,255,0.9); text-decoration: none; }

/* ====== MAIN HEADER ====== */
.site-header {
    background: var(--navy);
    padding: 0;
}
.header-inner {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
}
.site-brand {
    display: flex;
    align-items: center;
    padding: 0.85rem 0;
    gap: 1rem;
    text-decoration: none;
}
.site-brand:hover { text-decoration: none; }
.brand-text { line-height: 1.2; }
.brand-title {
    color: var(--white);
    font-size: 1.35rem;
    font-weight: 700;
    display: block;
}
.brand-sub {
    color: rgba(255,255,255,0.6);
    font-size: 0.78rem;
    display: block;
}

/* ====== NAV ====== */
.site-nav {
    display: flex;
    align-items: stretch;
}
.site-nav a {
    display: flex;
    align-items: center;
    color: rgba(255,255,255,0.82);
    padding: 0 1.2rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    text-decoration: none;
}
.site-nav a:hover,
.site-nav a.active {
    color: var(--white);
    border-bottom-color: var(--blue-light);
    text-decoration: none;
}

/* ====== BREADCRUMB ====== */
.breadcrumb {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0;
    font-size: 0.82rem;
    color: var(--muted);
}
.breadcrumb a { color: var(--blue); }
.breadcrumb span { margin: 0 0.4rem; }

/* ====== PAGE HERO (index) ====== */
.page-hero {
    background: linear-gradient(135deg, var(--navy) 0%, #1d4e8a 100%);
    color: white;
    padding: 2.5rem 0;
}
.page-hero h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.page-hero p {
    font-size: 0.95rem;
    opacity: 0.82;
    max-width: 620px;
    line-height: 1.7;
}

/* ====== ARTICLE LISTING ====== */
.listing-section {
    padding: 2rem 0 3rem;
}
.section-heading {
    font-size: 1rem;
    font-weight: 700;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--blue);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.section-heading .count {
    font-size: 0.75rem;
    background: var(--blue);
    color: white;
    padding: 0.1em 0.55em;
    border-radius: 10px;
    font-weight: 600;
}

.article-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

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

.article-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 1.25rem 1.5rem;
    transition: box-shadow 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.article-card:hover {
    box-shadow: 0 2px 12px rgba(0,112,184,0.12);
    border-color: var(--blue);
}
.card-number {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--blue);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.card-title {
    font-size: 0.97rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
}
.article-card:hover .card-title { color: var(--blue); }
.card-meta {
    font-size: 0.78rem;
    color: var(--muted);
}
.card-excerpt {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.6;
    margin-top: 0.2rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ====== ARTICLE PAGE ====== */
.article-layout {
    padding: 2rem 0 3.5rem;
}
.article-layout .container-narrow {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 2.5rem;
    align-items: start;
}
@media (max-width: 800px) {
    .article-layout .container-narrow { grid-template-columns: 1fr; }
    .article-sidebar { display: none; }
}

.article-main {}

.article-head {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}
.article-num {
    display: inline-block;
    background: var(--blue);
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2em 0.7em;
    border-radius: 3px;
    margin-bottom: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.article-head h1 {
    font-size: 1.55rem;
    color: var(--navy);
    line-height: 1.35;
    margin-bottom: 0.5rem;
}
.article-head .meta {
    color: var(--muted);
    font-size: 0.85rem;
}

/* Article body */
.article-body { line-height: 1.85; }

.article-body h2 {
    font-size: 1.15rem;
    color: var(--navy);
    margin: 2rem 0 0.75rem;
    padding: 0.5rem 0.85rem;
    background: #eef3fa;
    border-left: 4px solid var(--blue);
    border-radius: 0 3px 3px 0;
}
.article-body h3 {
    font-size: 1rem;
    color: var(--navy);
    margin: 1.5rem 0 0.5rem;
    font-weight: 600;
}
.article-body p { margin-bottom: 1rem; }
.article-body ul,
.article-body ol {
    margin: 0.4rem 0 1rem 1.5rem;
}
.article-body li { margin-bottom: 0.45rem; }

.article-body pre {
    background: var(--code-bg);
    color: var(--code-text);
    border-radius: 5px;
    padding: 1.2rem 1.4rem;
    overflow-x: auto;
    font-family: "Consolas", "Cascadia Code", "Source Code Pro", monospace;
    font-size: 0.82rem;
    line-height: 1.55;
    margin: 1.2rem 0;
    tab-size: 4;
}
.article-body code {
    background: #eef0f3;
    border: 1px solid #d0d5de;
    padding: 0.12em 0.45em;
    border-radius: 3px;
    font-family: "Consolas", "Cascadia Code", monospace;
    font-size: 0.85em;
    color: #c0392b;
}
.article-body pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}
.article-body .filename {
    background: #0d1a26;
    color: #8ab4d4;
    font-family: "Consolas", monospace;
    font-size: 0.78rem;
    padding: 0.4rem 1rem;
    border-radius: 5px 5px 0 0;
    margin-bottom: -0.4rem;
    display: inline-block;
}
.article-body blockquote {
    border-left: 4px solid var(--border);
    background: #f8f9fb;
    padding: 0.75rem 1.25rem;
    margin: 1rem 0;
    color: var(--muted);
    font-style: italic;
}

.original-note {
    margin-top: 2.5rem;
    padding: 0.85rem 1.1rem;
    background: #f0f6fd;
    border: 1px solid #c8dff4;
    border-radius: 4px;
    font-size: 0.83rem;
    color: var(--muted);
}
.original-note a { font-weight: 500; }

/* Article nav */
.article-pager {
    display: flex;
    justify-content: space-between;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    gap: 1rem;
}
.pager-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.15s, color 0.15s;
    text-decoration: none;
}
.pager-btn:hover {
    border-color: var(--blue);
    color: var(--blue);
    text-decoration: none;
}
.pager-btn.prev::before { content: "← "; }
.pager-btn.next::after  { content: " →"; }
.pager-placeholder { flex: 1; }

/* Sidebar */
.article-sidebar {
    position: sticky;
    top: 1.5rem;
}
.sidebar-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 1.2rem;
    margin-bottom: 1rem;
}
.sidebar-box h3 {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}
.sidebar-links { list-style: none; }
.sidebar-links li {
    padding: 0.3rem 0;
    font-size: 0.83rem;
    border-bottom: 1px solid #f0f0f0;
}
.sidebar-links li:last-child { border-bottom: none; }
.sidebar-links a { color: var(--text); }
.sidebar-links a:hover { color: var(--blue); text-decoration: none; }
.sidebar-links .current { color: var(--blue); font-weight: 600; }

/* ====== ARCHIVES PAGE ====== */
.archives-wrap { padding: 2rem 0 3rem; }
.archives-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 5px;
    overflow: hidden;
    font-size: 0.88rem;
}
.archives-table thead th {
    background: var(--navy);
    color: white;
    padding: 0.7rem 1rem;
    text-align: left;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.archives-table tbody td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid #eef0f4;
    vertical-align: middle;
}
.archives-table tbody tr:last-child td { border-bottom: none; }
.archives-table tbody tr:hover td { background: #f5f9ff; }
.archives-table .num { color: var(--muted); font-size: 0.8rem; width: 60px; }
.archives-table .translated { font-weight: 500; }
.badge-done {
    background: #27ae60;
    color: white;
    font-size: 0.7rem;
    padding: 0.15em 0.55em;
    border-radius: 10px;
    font-weight: 600;
}
.badge-pending {
    background: #bdc3c7;
    color: white;
    font-size: 0.7rem;
    padding: 0.15em 0.55em;
    border-radius: 10px;
}

/* ====== FOOTER ====== */
.site-footer {
    background: var(--navy-dark);
    color: rgba(255,255,255,0.55);
    padding: 2rem 0;
    font-size: 0.82rem;
    margin-top: auto;
}
.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    flex-wrap: wrap;
}
.footer-brand { color: rgba(255,255,255,0.7); font-size: 1rem; font-weight: 600; }
.site-footer a { color: rgba(255,255,255,0.6); }
.site-footer a:hover { color: rgba(255,255,255,0.9); text-decoration: none; }
.footer-note { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,0.1); font-size: 0.78rem; }

/* ============================================================
   RWD — Responsive / Mobile
   ============================================================ */

@media (max-width: 620px) {

    .container,
    .container-narrow { padding: 0 1rem; }

    /* Header: 品牌上方、導覽列下方 */
    .header-inner {
        flex-direction: column;
        align-items: stretch;
        padding-bottom: 0;
    }
    .site-brand { padding: 0.75rem 0 0.65rem; }
    .site-nav {
        border-top: 1px solid rgba(255,255,255,0.12);
    }
    .site-nav a {
        flex: 1;
        justify-content: center;
        padding: 0.55rem 0.5rem;
        font-size: 0.85rem;
        border-bottom: none;
        border-top: 3px solid transparent;
    }
    .site-nav a:hover,
    .site-nav a.active {
        border-top-color: var(--blue-light);
        border-bottom-color: transparent;
    }

    /* Hero */
    .page-hero { padding: 1.5rem 0; }
    .page-hero h1 { font-size: 1.25rem; }
    .page-hero p  { font-size: 0.88rem; }

    /* 文章頁標題與內文 */
    .article-head h1  { font-size: 1.2rem; }
    .article-body h2  { font-size: 1.0rem; }
    .article-body pre { font-size: 0.78rem; padding: 0.9rem 1rem; }

    /* 翻頁按鈕：垂直排列 */
    .article-pager     { flex-direction: column; gap: 0.6rem; }
    .pager-btn         { text-align: center; justify-content: center; width: 100%; white-space: normal; }
    .pager-placeholder { display: none; }

    /* Archives 表格：隱藏英文標題欄，允許橫向捲動 */
    .archives-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 0.82rem;
    }
    .archives-table thead th,
    .archives-table tbody td        { padding: 0.5rem 0.65rem; }
    .archives-table th:nth-child(3),
    .archives-table td:nth-child(3) { display: none; }

    /* Footer */
    .footer-inner { flex-direction: column; gap: 1rem; }
}

/* 極小螢幕（≤ 400px）：進一步隱藏日期欄 */
@media (max-width: 400px) {
    .archives-table th:nth-child(4),
    .archives-table td:nth-child(4) { display: none; }
}
