/* ==========================================================================
   台灣創業資源網 — Blog 主題（深藍色系）
   顏色都集中在 :root 的變數，想微調色調只要改這裡。
   ========================================================================== */

:root {
  --bg: #0a0e1a;
  --bg-2: #0d1424;
  --surface: #121a2e;
  --surface-2: #182140;
  --line: #1f2b45;
  --line-strong: #2c3c5e;

  --blue: #1656c9;
  --blue-light: #6fa3f5;
  --blue-dark: #0f3f9c;
  --blue-grad: linear-gradient(135deg, #7db0ff 0%, #1656c9 48%, #0f3f9c 100%);

  --text: #e7ebf5;
  --text-dim: #a9b4cc;
  --text-mute: #7c88a6;

  --danger: #e07a6b;
  --ok: #8fc48a;

  --radius: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --font-sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Noto Serif TC", "Songti TC", "PMingLiU", "Times New Roman", serif;
  --container: 1120px;
  --header-h: 68px;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: rgba(22, 86, 201, .18); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--blue-light); text-decoration: none; transition: color .15s; }
a:hover, a:focus-visible { color: #9dc1ff; text-decoration: underline; text-underline-offset: 3px; }

:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3, h4 { font-family: var(--font-serif); line-height: 1.4; color: var(--text); margin: 0 0 .6em; font-weight: 700; }
body:not(.admin) :is(h1, h2, h3, h4) { text-wrap: balance; overflow-wrap: anywhere; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 200;
  background: var(--blue); color: #fff; padding: 8px 14px; border-radius: 6px; font-weight: 700;
}
.skip-link:focus { left: 8px; }

.site-nav .nav-admin > a { color: var(--blue-light); border: 1px solid var(--blue-dark); border-radius: 999px; padding: 6px 14px; }
.site-nav .nav-admin > a:hover { border-color: var(--blue); text-decoration: none; }
.site-nav .nav-admin .sub-nav { left: auto; right: 0; }
.site-nav .nav-admin .sub-nav a { border: 0; border-radius: 6px; padding: 8px 12px; color: var(--text-dim); }
.site-nav .nav-admin .sub-nav a:hover { color: var(--blue-light); }

/* ---------- 頁首 / 導覽 ---------- */

.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10, 14, 26, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: var(--header-h); gap: 16px; }

.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); font-family: var(--font-serif); font-weight: 700; font-size: 1.15rem; letter-spacing: .06em; }
.brand:hover { color: var(--blue-light); text-decoration: none; }
.brand-mark {
  width: 22px; height: 22px; background: var(--blue-grad); transform: rotate(45deg);
  border-radius: 3px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 0 14px rgba(22, 86, 201, .45);
}
.brand-name { background: var(--blue-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 4px; }
.site-nav a { display: block; padding: 8px 14px; color: var(--text-dim); font-size: .95rem; border-radius: 6px; }
.site-nav a:hover, .site-nav a.is-active { color: var(--blue-light); text-decoration: none; background: rgba(22, 86, 201, .1); }
.site-nav a.is-active { box-shadow: inset 0 -2px 0 var(--blue); border-radius: 6px 6px 0 0; }

.site-nav .has-sub { position: relative; }
.sub-nav {
  display: none !important; position: absolute; top: 100%; left: 0; min-width: 190px; z-index: 50;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 6px !important; box-shadow: var(--shadow); flex-direction: column; align-items: stretch !important; gap: 0 !important;
}
.has-sub:hover > .sub-nav, .has-sub:focus-within > .sub-nav { display: flex !important; }
.sub-nav a { padding: 8px 12px; font-size: .9rem; }

.nav-toggle { display: none; flex: 0 0 auto; width: 44px; height: 44px; padding: 0; background: none; border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.nav-toggle-bar { display: block; width: 20px; height: 2px; background: var(--blue-light); margin: 0; transition: transform .2s, opacity .2s; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .js .site-nav { display: none; position: absolute; left: 0; right: 0; top: var(--header-h); background: var(--bg-2); border-bottom: 1px solid var(--line); padding: 8px 20px 16px;
    max-height: calc(100vh - var(--header-h)); max-height: calc(100dvh - var(--header-h)); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; box-shadow: 0 18px 30px rgba(0, 0, 0, .5); }
  .js .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; align-items: stretch; gap: 0; }
  .site-nav a { padding: 12px 8px; border-bottom: 1px solid var(--line); border-radius: 0; }
  .site-nav a.is-active { box-shadow: none; }
  .site-nav .nav-admin > a { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 12px 8px; }
  .site-nav .nav-admin .sub-nav a { border-radius: 0; border-bottom: 1px solid var(--line); padding: 12px 8px; }
  .sub-nav { display: flex !important; position: static; border: 0; box-shadow: none; background: transparent; padding: 0 0 0 14px !important; }
  .sub-nav a { padding: 10px 8px; font-size: .92rem; }
  .no-js .site-nav { width: 100%; }
  .no-js .header-inner { flex-wrap: wrap; }
  .no-js .site-nav ul { flex-direction: row; flex-wrap: wrap; }
}

/* ---------- 版面 ---------- */

.site-main { min-height: 60vh; padding-bottom: 72px; overflow-x: clip; }

.section { padding: 56px 0 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.section-title { font-size: 1.55rem; margin: 0; position: relative; padding-left: 16px; }
.section-title::before { content: ""; position: absolute; left: 0; top: .28em; bottom: .28em; width: 4px; border-radius: 2px; background: var(--blue-grad); }
.section-more { font-size: .9rem; }
.muted { color: var(--text-mute); }

.btn {
  display: inline-block; padding: 12px 26px; border-radius: 999px; font-weight: 700; font-size: .95rem; letter-spacing: .04em;
  border: 1px solid var(--blue); color: var(--blue-light); background: transparent; cursor: pointer; font-family: inherit; line-height: 1.4;
  transition: background .15s, color .15s, transform .15s;
}
.btn:hover { background: rgba(22, 86, 201, .14); color: var(--blue-light); text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--blue-grad); color: #fff; border-color: transparent; }
.btn-primary:hover { background: var(--blue-grad); color: #fff; filter: brightness(1.1); }

/* ---------- 文章卡片 ---------- */

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 24px; }
.card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); transition: border-color .2s, transform .2s, box-shadow .2s; }
.card:hover { border-color: var(--blue-dark); transform: translateY(-3px); box-shadow: var(--shadow); }
.card-cover { display: block; aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card:hover .card-cover img { transform: scale(1.04); }
.card-cover-placeholder {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
  font-family: var(--font-serif); font-size: 2.2rem; letter-spacing: .12em; color: var(--blue-light); text-shadow: 0 2px 14px rgba(0, 0, 0, .7);
  background: linear-gradient(160deg, var(--surface-2) 0%, var(--bg-2) 100%);
}
.card-body { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px 20px; flex: 1; }
.card-meta { margin: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.tag { display: inline-block; font-size: .75rem; letter-spacing: .05em; padding: 1px 10px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--blue-light); }
.tag-pillar { background: rgba(22, 86, 201, .16); border-color: var(--blue-dark); color: var(--blue-light); }
.card-title { font-size: 1.1rem; margin: 2px 0; overflow-wrap: anywhere; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--blue-light); text-decoration: none; }
.card-desc { margin: 0; color: var(--text-dim); font-size: .92rem; line-height: 1.75; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { margin: auto 0 0; padding-top: 8px; color: var(--text-mute); font-size: .8rem; }

.empty-note { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 36px 20px; text-align: center; color: var(--text-mute); background: var(--bg-2); }

/* ---------- 主題分類 chips（分類頁的子主題） ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 0; padding: 0; list-style: none; }
.chips a { display: inline-block; border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px 12px; font-size: .85rem; color: var(--text-dim); }
.chips a:hover { border-color: var(--blue); color: var(--blue-light); text-decoration: none; }

/* ---------- 頁面標題 / 麵包屑 ---------- */

.page-head { padding: 44px 0 30px; border-bottom: 1px solid var(--line); background: radial-gradient(ellipse 70% 100% at 50% 0%, rgba(22, 86, 201, .12), transparent 70%); }
.page-head h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin: 0 0 10px; }
.page-head .lead { margin: 0; max-width: 720px; color: var(--text-dim); }

.breadcrumb { padding: 18px 0 0; font-size: .85rem; }
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumb li { color: var(--text-mute); }
.breadcrumb li + li::before { content: "›"; margin-right: 6px; color: var(--blue-dark); }
.breadcrumb a { color: var(--text-dim); }
.breadcrumb a:hover { color: var(--blue-light); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 26px 0 22px; }
.toolbar .label { color: var(--text-mute); font-size: .9rem; margin-right: 4px; }
.pill { display: inline-block; padding: 4px 16px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--text-dim); font-size: .88rem; }
.pill:hover { border-color: var(--blue); color: var(--blue-light); text-decoration: none; }
.pill.is-active { background: rgba(22, 86, 201, .16); border-color: var(--blue); color: var(--blue-light); }

/* ---------- 分頁 ---------- */

.pager { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 44px 0 0; }
.pager a, .pager span { min-width: 40px; padding: 6px 14px; text-align: center; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--text-dim); font-size: .92rem; }
.pager a:hover { border-color: var(--blue); color: var(--blue-light); text-decoration: none; }
.pager .is-current { background: var(--blue-grad); color: #fff; border-color: transparent; font-weight: 700; }

/* ---------- 文章頁 ---------- */

.article-wrap { max-width: 800px; margin: 0 auto; padding: 0 20px; }
.article-head { padding: 12px 0 8px; }
.article-head h1 { font-size: clamp(1.7rem, 4.2vw, 2.4rem); margin: 10px 0 14px; }
.article-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--text-mute); font-size: .85rem; margin: 0 0 20px; }
.article-meta a { color: var(--text-dim); }
.article-lead, .answer-block { font-size: 1.1rem; color: var(--text); padding: 18px 22px; border-left: 3px solid var(--blue); background: linear-gradient(90deg, rgba(22, 86, 201, .1), transparent); border-radius: 0 var(--radius) var(--radius) 0; margin: 0 0 26px; }
.article-cover { margin: 0 0 30px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; }
.article-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.preview-banner { margin: 18px 0 0; padding: 10px 16px; border: 1px dashed var(--blue); border-radius: 8px; color: var(--blue-light); background: rgba(22, 86, 201, .1); font-size: .9rem; }

.toc { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 18px 22px; background: var(--surface); margin: 0 0 34px; }
.toc-title { font-family: var(--font-serif); color: var(--blue-light); margin: 0 0 8px; font-size: 1.02rem; }
.toc ol { margin: 0; padding-left: 1.4em; color: var(--text-mute); }
.toc li { margin: 4px 0; }
.toc a { color: var(--text-dim); }
.toc a:hover { color: var(--blue-light); }

.article-content section { margin: 0 0 40px; }
.article-content h2 { font-size: 1.45rem; margin: 44px 0 16px; padding-bottom: 10px; border-bottom: 1px solid var(--line-strong); scroll-margin-top: calc(var(--header-h) + 16px); position: relative; }
.article-content h2::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 64px; height: 2px; background: var(--blue-grad); }
.article-content h3 { font-size: 1.15rem; margin: 30px 0 10px; color: var(--blue-light); scroll-margin-top: calc(var(--header-h) + 16px); }
.article-content p { margin: 0 0 1.2em; color: var(--text); }
.article-content ul, .article-content ol { margin: 0 0 1.3em; padding-left: 1.5em; }
.article-content li { margin: .35em 0; }
.article-content li::marker { color: var(--blue-light); }
.article-content strong { color: var(--blue-light); }
.article-content blockquote { margin: 1.4em 0; padding: 14px 20px; border-left: 3px solid var(--blue-dark); background: var(--surface); color: var(--text-dim); border-radius: 0 8px 8px 0; }
.article-content img { border-radius: 8px; margin: 1.2em 0; }
.article-content { overflow-wrap: anywhere; }
.article-content pre { margin: 1.4em 0; padding: 14px 16px; overflow-x: auto; max-width: 100%; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; font-size: .88rem; line-height: 1.65; -webkit-overflow-scrolling: touch; }
.article-content code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.article-content :not(pre) > code { padding: 1px 6px; background: var(--surface-2); border-radius: 4px; color: var(--blue-light); }
.article-content pre code { white-space: pre; overflow-wrap: normal; }
.article-content figure { margin: 1.2em 0; }
.article-content iframe, .article-content video, .article-content embed, .article-content object { max-width: 100%; }
.article-content .table-wrap, .article-content table { width: 100%; }
.article-content table { border-collapse: collapse; margin: 1.4em 0; font-size: .95rem; display: block; overflow-x: auto; }
.article-content th, .article-content td { border: 1px solid var(--line-strong); padding: 10px 14px; text-align: left; vertical-align: top; }
.article-content th { background: var(--surface-2); color: var(--blue-light); white-space: nowrap; }

.video { position: relative; aspect-ratio: 16 / 9; margin: 0 0 34px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.faq { margin-top: 12px; }
.faq h3 { border-left: 3px solid var(--blue); padding-left: 12px; }

.notice { margin: 34px 0 0; padding: 16px 20px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--bg-2); color: var(--text-mute); font-size: .88rem; line-height: 1.75; }

.related { margin-top: 56px; }

/* ---------- 錯誤頁 ---------- */

.error-page { text-align: center; padding: 100px 0 40px; }
.error-code { font-family: var(--font-serif); font-size: clamp(4rem, 14vw, 8rem); line-height: 1; margin: 0 0 10px; background: var(--blue-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-page h1 { font-size: 1.6rem; }
.error-page p { color: var(--text-dim); max-width: 480px; margin: 0 auto 28px; }

/* ---------- 頁尾 ---------- */

.site-footer { border-top: 1px solid var(--line); background: var(--bg-2); padding-top: 48px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 36px; }
.footer-brand { font-family: var(--font-serif); font-size: 1.2rem; margin: 0 0 10px; background: var(--blue-grad); -webkit-background-clip: text; background-clip: text; color: transparent; display: inline-block; }
.footer-about { color: var(--text-mute); font-size: .9rem; margin: 0; line-height: 1.8; }
.footer-col p { color: var(--text-mute); font-size: .9rem; margin: 0; line-height: 1.8; }
.footer-title { font-size: .95rem; letter-spacing: .1em; color: var(--blue-light); margin: 0 0 12px; font-family: var(--font-sans); }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin: 6px 0; }
.footer-col a { color: var(--text-dim); font-size: .92rem; }
.footer-col a:hover { color: var(--blue-light); }
.footer-bottom { margin-top: 36px; padding-top: 18px; padding-bottom: 28px; border-top: 1px solid var(--line); }
.footer-bottom p { margin: 0; color: var(--text-mute); font-size: .875rem; }

/* ---------- 響應式 ---------- */

@media (max-width: 860px) {
  .footer-grid { grid-template-columns: 1fr; gap: 26px; }
}
/* 觸控 / 窄螢幕：放大可點擊範圍（至少約 40–44px）；整張卡片都可點 */
@media (max-width: 860px), (pointer: coarse) {
  body:not(.admin) .breadcrumb { padding-top: 8px; }
  body:not(.admin) .breadcrumb ol { gap: 0 6px; }
  body:not(.admin) .breadcrumb li { display: inline-flex; align-items: center; min-height: 40px; }
  body:not(.admin) .breadcrumb a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 3px; }
  body:not(.admin) .section-more { display: inline-flex; align-items: center; min-height: 44px; }
  body:not(.admin) .toc li { margin: 0; }
  body:not(.admin) .toc a { display: inline-block; padding: 6px 0; }
  body:not(.admin) .footer-col li { margin: 0; }
  body:not(.admin) .footer-col a { display: inline-block; padding: 8px 0; }
  body:not(.admin) .pill { padding: 9px 18px; }
  body:not(.admin) .chips { gap: 10px; }
  body:not(.admin) .chips a { position: relative; z-index: 1; padding: 8px 15px; }
  body:not(.admin) .pager a, body:not(.admin) .pager span { min-width: 44px; padding: 10px 14px; }
  body:not(.admin) .card { position: relative; }
  body:not(.admin) .card-title a::after { content: ""; position: absolute; inset: 0; z-index: 0; }
  body:not(.admin) .brand { min-height: 44px; }
}

/* 觸控裝置沒有 hover：不要讓卡片「點了之後卡在浮起的狀態」 */
@media (hover: none) {
  body:not(.admin) .card:hover, body:not(.admin) .btn:hover { transform: none; }
  body:not(.admin) .card:hover .card-cover img { transform: none; }
  body:not(.admin) .card:hover { box-shadow: none; }
}

@media (max-width: 520px) {
  :root { --header-h: 60px; }
  body:not(.admin) .container { padding: 0 16px; }
  body:not(.admin) .article-wrap { padding: 0 16px; }
  body:not(.admin) .header-inner { gap: 10px; }
  body:not(.admin) .brand { min-width: 0; gap: 10px; font-size: 1.05rem; letter-spacing: .03em; }
  body:not(.admin) .card-grid { grid-template-columns: 1fr; }
  body:not(.admin) .section { padding-top: 40px; }
  body:not(.admin) .section-title { font-size: 1.35rem; }
  body:not(.admin) .card-body { padding: 16px 18px 18px; }
  body:not(.admin) .page-head { padding: 30px 0 22px; }
  body:not(.admin) .page-head h1 { font-size: 1.6rem; }
  body:not(.admin) .article-head h1 { font-size: 1.6rem; }
  body:not(.admin) .article-lead, body:not(.admin) .answer-block { font-size: 1.02rem; padding: 14px 16px; }
  body:not(.admin) .article-content h2 { font-size: 1.3rem; margin-top: 36px; }
  body:not(.admin) .article-content h3 { font-size: 1.1rem; }
  body:not(.admin) .article-content table { font-size: .9rem; }
  body:not(.admin) .article-content th, body:not(.admin) .article-content td { padding: 8px 10px; }
  body:not(.admin) .article-content td { min-width: 6.5em; }
  body:not(.admin) .toc { padding: 16px 18px; }
  body:not(.admin) .error-page { padding: 64px 0 24px; }
  body:not(.admin) .site-footer { padding-top: 36px; }
  body:not(.admin) .footer-grid { gap: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .site-header, .site-footer, .pager, .toc, .related { display: none; }
  body { background: #fff; color: #000; }
}

/* 文章 HTML 規格：內文 AI 配圖 */
.article-content .article-ai-img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; margin: 22px 0; border: 1px solid var(--line); border-radius: var(--radius); }
.spec-issues ul, .ai-img-status ul { margin: 6px 0 12px 1.2em; padding: 0; }
