/* ============================================================
   線上鋼鐵手冊 — 主樣式
   設計調性：工業、精準、冷色金屬感
   ============================================================ */

:root {
    /* 主色：鋼鐵冷藍 */
    --steel-900: #0f172a;
    --steel-800: #1e293b;
    --steel-700: #334155;
    --steel-600: #475569;
    --steel-500: #64748b;
    --steel-400: #94a3b8;
    --steel-300: #cbd5e1;
    --steel-200: #e2e8f0;
    --steel-100: #f1f5f9;
    --steel-50:  #f8fafc;

    /* 強調色：工程藍 */
    --accent:    #2563eb;
    --accent-dk: #1d4ed8;
    --accent-lt: #dbeafe;

    /* 輔助色 */
    --ok:   #059669;
    --warn: #d97706;

    --surface: #ffffff;
    --bg:      #f3f6fb;
    --line:    #e2e8f0;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-lg: 0 10px 30px rgba(15, 23, 42, .09);

    --mono: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--steel-800);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: 'tnum';
}

.wrap { max-width: 960px; margin: 0 auto; padding: 0 1rem; }

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

h1, h2, h3, h4 { color: var(--steel-900); line-height: 1.35; font-weight: 700; }

/* ---------- 頁首 ---------- */
.site-header {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 50;
}
.header-inner {
    display: flex; align-items: center; gap: 1.5rem;
    min-height: 66px;
}
.brand {
    display: flex; align-items: center; gap: .7rem;
    color: var(--steel-900); text-decoration: none; flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand-icon {
    display: grid; place-items: center;
    width: 40px; height: 40px; border-radius: 10px;
    background: linear-gradient(135deg, var(--steel-800), var(--steel-600));
    color: #fff; flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 1.06rem; letter-spacing: .01em; }
.brand-text small { color: var(--steel-500); font-size: .74rem; font-weight: 400; }

.site-nav { display: flex; gap: .15rem; margin-left: auto; flex-wrap: wrap; }
.site-nav a {
    padding: .5rem .78rem; border-radius: var(--radius-sm);
    color: var(--steel-600); font-size: .9rem; font-weight: 500;
    transition: background .15s, color .15s; white-space: nowrap;
}
.site-nav a:hover { background: var(--steel-100); color: var(--steel-900); text-decoration: none; }
.site-nav a.active { background: var(--accent-lt); color: var(--accent-dk); font-weight: 600; }

.nav-toggle {
    display: none; margin-left: auto;
    flex-direction: column; gap: 4px; justify-content: center;
    width: 42px; height: 42px; border: 1px solid var(--line);
    border-radius: var(--radius-sm); background: #fff; cursor: pointer;
}
.nav-toggle span {
    display: block; width: 18px; height: 2px; margin: 0 auto;
    background: var(--steel-700); border-radius: 2px; transition: .2s;
}

/* ---------- 主內容 ---------- */
.main { padding: 1.25rem 1rem 2.5rem; }

/* ---------- 英雄區 ---------- */
.hero {
    background: linear-gradient(135deg, var(--steel-900) 0%, var(--steel-700) 100%);
    border-radius: var(--radius);
    padding: 2.4rem 2rem;
    color: #fff;
    margin-bottom: 1.75rem;
    position: relative;
    overflow: hidden;
}
.hero::after {
    content: ''; position: absolute; right: -60px; top: -60px;
    width: 280px; height: 280px; border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, .35), transparent 70%);
}
.hero h1 { color: #fff; font-size: clamp(1.5rem, 3.4vw, 2.05rem); margin: 0 0 .6rem; }
.hero p { color: var(--steel-300); font-size: 1rem; margin: 0 0 1.3rem; max-width: 640px; }
.hero-stats { display: flex; gap: 2rem; flex-wrap: wrap; }
.hero-stat b { display: block; font-size: 1.55rem; color: #fff; font-family: var(--mono); }
.hero-stat span { color: var(--steel-400); font-size: .8rem; }

/* ---------- 搜尋框 ---------- */
.search-box {
    display: flex; gap: .6rem; max-width: 560px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: var(--radius-sm); padding: .35rem;
    backdrop-filter: blur(6px);
}
.search-box input {
    flex: 1; border: none; background: transparent; color: #fff;
    padding: .6rem .8rem; font-size: .95rem; outline: none;
}
.search-box input::placeholder { color: var(--steel-400); }
.search-box button {
    border: none; background: var(--accent); color: #fff;
    padding: .6rem 1.25rem; border-radius: 6px; font-size: .9rem;
    font-weight: 600; cursor: pointer; transition: background .15s;
}
.search-box button:hover { background: var(--accent-dk); }

/* ---------- 類別卡片 ---------- */
.section-title {
    display: flex; align-items: baseline; gap: .75rem;
    margin: 2rem 0 1rem;
}
.section-title h2 { font-size: 1.25rem; margin: 0; }
.section-title .count { color: var(--steel-500); font-size: .84rem; }

.cat-grid {
    display: grid; gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.cat-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1.15rem 1.25rem;
    display: flex; flex-direction: column; gap: .55rem;
    box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s, border-color .18s;
    text-decoration: none;
}
.cat-card:hover {
    transform: translateY(-3px); box-shadow: var(--shadow-lg);
    border-color: var(--accent-lt); text-decoration: none;
}
.cat-head { display: flex; align-items: center; gap: .6rem; }
.cat-badge {
    display: grid; place-items: center; flex-shrink: 0;
    width: 38px; height: 38px; border-radius: 9px;
    background: var(--accent-lt); color: var(--accent-dk);
    font-family: var(--mono); font-weight: 700; font-size: .88rem;
}
.cat-card h3 { margin: 0; font-size: 1.02rem; color: var(--steel-900); }
.cat-card p { margin: 0; color: var(--steel-500); font-size: .85rem; flex: 1; }
.cat-meta { display: flex; gap: 1rem; font-size: .8rem; color: var(--steel-600); font-family: var(--mono); }
.cat-meta b { color: var(--accent-dk); }

/* ---------- 表格 ---------- */
.table-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}
.table-scroll { overflow-x: auto; }
table.spec {
    width: 100%; border-collapse: collapse; font-size: .84rem;
    min-width: 640px;
}
table.spec thead th {
    background: var(--steel-100); color: var(--steel-700);
    font-weight: 600; text-align: right; white-space: nowrap;
    padding: .55rem .6rem; border-bottom: 1px solid var(--line);
    position: sticky; top: 0;
}
table.spec thead th:first-child,
table.spec thead th:nth-child(2) { text-align: left; }
table.spec tbody td {
    padding: .48rem .6rem; border-bottom: 1px solid var(--steel-100);
    text-align: right; font-family: var(--mono); white-space: nowrap;
    color: var(--steel-700);
}
table.spec tbody td:first-child,
table.spec tbody td:nth-child(2) { text-align: left; font-family: inherit; }
table.spec tbody tr:hover { background: var(--steel-50); }
table.spec tbody tr:last-child td { border-bottom: none; }
table.spec .model {
    font-weight: 600; color: var(--steel-900); font-family: var(--mono);
}
table.spec a.model:hover { color: var(--accent); }
table.spec .hi { color: var(--accent-dk); font-weight: 600; }
table.spec .dim { width: 60px; padding: 2px .4rem; }
table.spec .dim svg { display: block; margin: 0 auto; }

/* ---------- 內頁 ---------- */
.page-head { margin-bottom: 1.5rem; }
.breadcrumb {
    font-size: .82rem; color: var(--steel-500); margin-bottom: .6rem;
}
.breadcrumb a { color: var(--steel-500); }
.breadcrumb span { margin: 0 .4rem; color: var(--steel-300); }
.page-head h1 { font-size: 1.7rem; margin: 0 0 .5rem; }
.page-head .lead { color: var(--steel-600); font-size: .96rem; margin: 0; max-width: 760px; }

/* ---------- 詳情卡 ---------- */
.spec-detail {
    display: grid; gap: 1.5rem;
    grid-template-columns: 320px 1fr;
    margin-bottom: 1.75rem;
}
.detail-fig {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1.25rem;
    display: flex; flex-direction: column; align-items: center; gap: .75rem;
    box-shadow: var(--shadow);
}
.detail-fig svg { max-width: 100%; height: auto; }
.detail-fig .cap { font-family: var(--mono); font-size: .82rem; color: var(--steel-500); }
.kv-grid {
    display: grid; gap: .75rem;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    align-content: start;
}
.kv {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius-sm); padding: .8rem .9rem;
}
.kv .k { color: var(--steel-500); font-size: .76rem; display: block; margin-bottom: .28rem; }
.kv .v { font-family: var(--mono); font-size: 1.18rem; font-weight: 600; color: var(--steel-900); }
.kv .v small { font-size: .72rem; color: var(--steel-500); font-weight: 400; margin-left: .25rem; font-family: inherit; }
.kv.accent { border-color: var(--accent-lt); background: #f7fbff; }
.kv.accent .v { color: var(--accent-dk); }

/* 計算器斷面圖 */
.fig-slot {
    margin-top: 1.25rem; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1rem; display: grid; place-items: center; box-shadow: var(--shadow);
}
.fig-slot svg { max-width: 260px; height: auto; }

/* ---------- 計算器 ---------- */
.calc-layout { display: grid; gap: 1.5rem; grid-template-columns: 330px 1fr; align-items: start; }
.calc-panel {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow);
}
.calc-panel h3 { margin: 0 0 1rem; font-size: 1.02rem; }
.field { margin-bottom: .9rem; }
.field label { display: block; font-size: .82rem; color: var(--steel-600); margin-bottom: .3rem; font-weight: 500; }
.field input, .field select {
    width: 100%; padding: .6rem .75rem; border: 1px solid var(--steel-200);
    border-radius: var(--radius-sm); font-size: .92rem; font-family: var(--mono);
    color: var(--steel-900); background: #fff; outline: none; transition: border-color .15s;
}
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    width: 100%; padding: .7rem 1rem; border: none; border-radius: var(--radius-sm);
    background: var(--accent); color: #fff; font-size: .92rem; font-weight: 600;
    cursor: pointer; transition: background .15s;
}
.btn:hover { background: var(--accent-dk); }
.btn.ghost { background: var(--steel-100); color: var(--steel-700); }
.btn.ghost:hover { background: var(--steel-200); }

/* ---------- 其他 ---------- */
.alert {
    background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
    border-radius: var(--radius-sm); padding: .8rem 1rem; font-size: .86rem;
    margin-bottom: 1.25rem;
}
.note {
    background: var(--steel-50); border-left: 3px solid var(--accent-lt);
    border-radius: 4px; padding: .8rem 1rem; font-size: .86rem; color: var(--steel-600);
    margin: 1.25rem 0;
}
.pill-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.pill {
    padding: .38rem .85rem; border-radius: 999px; font-size: .84rem;
    background: var(--surface); border: 1px solid var(--line);
    color: var(--steel-600); transition: .15s;
}
.pill:hover { border-color: var(--accent); color: var(--accent-dk); text-decoration: none; }
.pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- 尺寸定義圖（緊湊單列） ---------- */
.dim-guide {
    display: inline-flex; align-items: center; gap: .75rem;
    width: fit-content; max-width: 100%;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: .5rem .7rem;
    box-shadow: var(--shadow); margin-bottom: .9rem;
}
.dim-guide-fig {
    flex: 0 0 auto;
    display: grid; place-items: center;
    background: #fff; border: 1px solid var(--steel-100);
    border-radius: 6px; padding: 0;
    line-height: 0;
}
.dim-guide-fig svg {
    display: block;
    width: 112px; height: auto;
}
.dim-guide-info {
    flex: 0 1 auto; min-width: 0;
    display: flex; flex-direction: column; gap: .35rem;
}
.dim-naming {
    margin: 0; font-size: .86rem; color: var(--steel-700);
    display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .5rem;
}
.dim-naming code {
    font-family: var(--mono); background: var(--accent-lt); color: var(--accent-dk);
    padding: .02rem .28rem; border-radius: 3px; font-size: .86em; font-weight: 600;
}
.dim-unit {
    color: var(--steel-400); font-size: .74rem;
}
.dim-example {
    color: var(--steel-500); font-size: .78rem;
    font-family: var(--mono);
}
.dim-chips {
    display: flex; flex-wrap: wrap; gap: .25rem;
}
.dim-chip {
    display: inline-flex; align-items: center; gap: .2rem;
    padding: .14rem .4rem; border-radius: 999px;
    background: var(--steel-50); border: 1px solid var(--steel-100);
    font-size: .72rem; color: var(--steel-600); white-space: nowrap;
}
.dim-chip code {
    font-family: var(--mono); font-weight: 700; color: var(--accent-dk);
    font-size: .74rem;
}
.dim-filter {
    width: 220px; max-width: 100%;
    padding: .38rem .65rem; border: 1px solid var(--steel-200);
    border-radius: 6px; font-size: .84rem; font-family: var(--mono);
    color: var(--steel-900); background: #fff; outline: none;
}
.dim-filter:focus {
    border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

@media (max-width: 560px) {
    .dim-guide { display: flex; width: 100%; align-items: flex-start; }
    .dim-guide-fig svg { width: 96px; }
    .dim-filter { width: 100%; }
}

.faq-item {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: .85rem;
}
.faq-item h3 { font-size: 1rem; margin: 0 0 .5rem; }
.faq-item p { margin: 0; color: var(--steel-600); font-size: .9rem; }

/* ---------- 頁尾 ---------- */
.site-footer {
    background: var(--steel-900); color: var(--steel-400);
    margin-top: 3rem; padding: 2.5rem 0 1.5rem; font-size: .87rem;
}
.footer-inner {
    display: grid; gap: 2rem;
    grid-template-columns: 1.6fr 1fr 1fr;
    padding-bottom: 1.75rem; border-bottom: 1px solid var(--steel-700);
}
.footer-col h4 { color: #fff; font-size: .92rem; margin: 0 0 .85rem; }
.footer-desc { margin: 0; color: var(--steel-500); font-size: .84rem; line-height: 1.7; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: .45rem; }
.footer-col a { color: var(--steel-400); font-size: .84rem; }
.footer-col a:hover { color: #fff; }
.footer-net { columns: 2; }
.footer-col a.here { color: var(--accent-lt); font-weight: 600; }
.footer-bottom {
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem; flex-wrap: wrap; padding-top: 1.25rem;
}
.copyright { margin: 0; color: var(--steel-500); font-size: .8rem; }
.footer-counter { font-size: .78rem; color: var(--steel-400); }
.footer-counter #website-counter {
    border-top: none !important;
    margin: 0 !important;
    padding: 0 !important;
    color: var(--steel-400) !important;
    text-align: right !important;
}
.footer-counter #counter-content {
    justify-content: flex-end !important;
    gap: 4px 12px !important;
}

/* ---------- 響應式 ---------- */
@media (max-width: 900px) {
    .spec-detail { grid-template-columns: 1fr; }
    .detail-fig { max-width: 340px; }
    .calc-layout { grid-template-columns: 1fr; }
    .footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
    .nav-toggle { display: flex; }
    .site-nav {
        display: none; position: absolute; top: 100%; left: 0; right: 0;
        flex-direction: column; background: #fff; padding: .75rem;
        border-bottom: 1px solid var(--line); box-shadow: var(--shadow-lg); gap: .15rem;
    }
    .site-nav.open { display: flex; }
    .site-nav a { padding: .7rem .85rem; }
    .hero { padding: 1.75rem 1.25rem; }
    .hero-stats { gap: 1.25rem; }
    .footer-inner { grid-template-columns: 1fr; gap: 1.5rem; }
    .footer-net { columns: 1; }
    .footer-bottom { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 420px) {
    .brand-text small { display: none; }
    .cat-grid { grid-template-columns: 1fr; }
}
