/* ============================================
   哇哇3C日誌 — Broadsheet v5
   報章版頭 × 英雄首頁 × 深海藍珊瑚紅
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;600;700;900&display=swap');

/* ============================================
   Design Tokens
   ============================================ */

:root {
  /* Navy 色階 */
  --navy-1: #071523;
  --navy-2: #0D2138;
  --navy-3: #12304F;
  --navy-4: #1C3F60;

  /* 珊瑚紅 */
  --coral:      #E55C3A;
  --coral-dark: #C44E30;
  --coral-mid:  #ED7D60;
  --coral-pale: #FEF0EC;
  --coral-line: #FECAB8;

  /* 主要背景（Adsense 友善）*/
  --bg:    #F2F5FA;
  --card:  #FFFFFF;

  /* 文字 */
  --ink:       #0D1927;
  --body:      #2E3F55;
  --secondary: #586A82;
  --muted:     #8699AF;
  --faint:     #C0CCd9;

  /* 邊框 */
  --border:       #D6DDE8;
  --border-light: #E8EDF5;
  --divider:      #EAEEF6;

  /* 陰影 */
  --shadow-xs:  0 1px 3px  rgba(13,33,56,.06);
  --shadow-sm:  0 2px 8px  rgba(13,33,56,.08);
  --shadow-md:  0 6px 20px rgba(13,33,56,.10);
  --shadow-lg:  0 12px 40px rgba(13,33,56,.14);

  /* 字體 */
  --f:    'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  --mono: 'Consolas', 'Monaco', 'Courier New', monospace;

  /* 尺寸 */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;

  /* 動畫 */
  --ease:   cubic-bezier(.25,.1,.25,1);
  --t-fast: 140ms;
  --t-mid:  260ms;
  --t-slow: 420ms;
}

/* ============================================
   Reset & Base
   ============================================ */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--f);
  background: var(--bg);
  color: var(--body);
  line-height: 1.75;
  min-height: 100vh;
}

h1,h2,h3,h4,h5,h6 {
  font-family: var(--f);
  color: var(--ink);
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: -.01em;
}

p { margin-bottom: 1rem; }

a {
  color: var(--coral);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}
a:hover { color: var(--coral-dark); }

strong, b { font-weight: 700; color: var(--ink); }

hr { border: none; border-top: 1px solid var(--divider); margin: 2rem 0; }

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

/* ============================================
   ① 報章版頭 HEADER
   ============================================ */

/* 舊 Bootstrap header 完全隱藏（透過 class 覆寫） */
header.wrapper.bg-light.d-none-legacy { display: none !important; }

/* ─── Topbar ─── */
.site-topbar {
  background: var(--navy-1);
  border-bottom: 1px solid var(--navy-3);
  padding: 0;
  height: 36px;
  display: flex;
  align-items: center;
}

.site-topbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar-date {
  font-size: .7rem;
  color: #6A8BAD;
  letter-spacing: .05em;
  font-weight: 500;
}

.topbar-social {
  display: flex;
  gap: .1rem;
}

.topbar-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: #6A8BAD;
  font-size: .95rem;
  border-radius: 50%;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}

.topbar-social a:hover {
  color: var(--coral-mid);
  background: rgba(255,255,255,.07);
}

/* ─── Masthead ─── */
.site-masthead {
  background: var(--navy-2);
  padding: 1.4rem 0 1.2rem;
  text-align: center;
  position: relative;
  border-bottom: 2px solid var(--coral);
}

.masthead-brand {
  display: inline-block;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 900;
  color: #fff !important;
  letter-spacing: -.03em;
  line-height: 1;
  text-decoration: none;
  transition: opacity var(--t-fast) var(--ease);
}

.masthead-brand:hover { opacity: .85; }

/* 品牌點 */
.masthead-brand::after {
  content: '.';
  color: var(--coral);
}

.masthead-tagline {
  font-size: .72rem;
  color: #5C7A99;
  letter-spacing: .1em;
  margin: .4rem 0 0;
  font-weight: 500;
}

/* ─── 分類導覽列 ─── */
.site-nav {
  background: var(--navy-1);
  border-bottom: 1px solid rgba(255,255,255,.06);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.site-nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
}

.site-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: stretch;
  flex-wrap: nowrap;
  overflow: visible;
  gap: 0;
}

.site-nav-list li { position: relative; }

.site-nav-list a,
.site-nav-list button {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 .9rem;
  font-size: .78rem;
  font-weight: 600;
  color: #A8BFCF !important;
  letter-spacing: .03em;
  white-space: nowrap;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
  text-decoration: none;
  font-family: var(--f);
  position: relative;
}

.site-nav-list a:hover,
.site-nav-list button:hover {
  color: #fff !important;
  background: rgba(255,255,255,.06);
}

/* 底部 active 線 */
.site-nav-list a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: .9rem;
  right: .9rem;
  height: 2px;
  background: var(--coral);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-mid) var(--ease);
}

.site-nav-list a:hover::after { transform: scaleX(1); }

/* Dropdown */
.nav-dropdown { position: relative; }

.nav-dropdown-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: var(--navy-2);
  border: 1px solid var(--navy-4);
  border-top: 2px solid var(--coral);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  padding: .4rem 0;
}

.nav-dropdown:hover .nav-dropdown-panel,
.nav-dropdown:focus-within .nav-dropdown-panel { display: block; }

.nav-dropdown-panel a {
  display: block;
  height: auto;
  padding: .42rem 1rem;
  font-size: .78rem;
  color: #A8BFCF !important;
  width: 100%;
}

.nav-dropdown-panel a:hover {
  background: var(--navy-3);
  color: #fff !important;
}

.nav-dropdown-panel a::after { display: none !important; }

/* Mobile toggle */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 48px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0 12px;
  flex-shrink: 0;
}

.mobile-menu-toggle span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: #A8BFCF;
  transition: all var(--t-mid) var(--ease);
  border-radius: 2px;
}

.mobile-menu-toggle:hover span { background: #fff; }

/* ─── Mobile menu overlay ─── */
.mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--navy-1);
  z-index: 2000;
  overflow-y: auto;
}

.mobile-menu.is-open { display: block; }

.mobile-menu-inner { padding: 1.5rem; }

.mobile-menu-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--navy-3);
  margin-bottom: 1rem;
}

.mobile-menu-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.mobile-menu-close {
  width: 36px;
  height: 36px;
  background: var(--navy-3);
  border: none;
  border-radius: 50%;
  color: #A8BFCF;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast) var(--ease);
}

.mobile-menu-close:hover { background: var(--navy-4); color: #fff; }

.mobile-menu-links { display: flex; flex-direction: column; }

.mobile-menu-links a {
  display: block;
  padding: .75rem 0;
  border-bottom: 1px solid var(--navy-3);
  color: #A8BFCF !important;
  font-size: .92rem;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}

.mobile-menu-links a:hover { color: var(--coral-mid) !important; }

/* ============================================
   ② 主要內容容器
   ============================================ */

/* 舊 Bootstrap section */
section.wrapper.bg-light {
  background: var(--bg) !important;
}

.blog-content {
  padding-right: 2.5rem !important;
}

@media (max-width: 991.98px) {
  .blog-content { padding-right: 0 !important; }
}

@media (min-width: 992px) {
  .blog-content {
    flex: 1 1 0% !important;
    max-width: none !important;
    width: auto !important;
  }
  .sidebar {
    flex: 0 0 360px !important;
    max-width: 360px !important;
  }
}

/* ============================================
   ③ 首頁英雄貼文
   ============================================ */

.post-hero-wrap {
  margin-bottom: 2.5rem;
  animation: heroIn .6s var(--ease) both;
}

.post-hero {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--navy-1);
  display: block;
  aspect-ratio: 21/9;
}

@media (max-width: 767.98px) {
  .post-hero { aspect-ratio: 16/9; }
}

.post-hero-link {
  display: block;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

.post-hero-img {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.post-hero-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--t-slow) var(--ease);
  opacity: 0;
  transition: opacity .4s ease, transform var(--t-slow) var(--ease);
}

.post-hero-img img.loaded { opacity: 1; }

.post-hero:hover .post-hero-img img {
  transform: scale(1.04);
}

/* Gradient overlay */
.post-hero-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(7,21,35,.92) 0%,
    rgba(7,21,35,.55) 40%,
    rgba(7,21,35,.1) 100%
  );
}

/* Text layer */
.post-hero-body {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 2.5rem;
  z-index: 1;
}

@media (max-width: 575.98px) {
  .post-hero-body { padding: 1.25rem 1.25rem; }
}

.post-hero .post-category a {
  display: inline-block;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--ink) !important;
  background: var(--coral);
  padding: .2rem .6rem;
  border-radius: var(--r-sm);
  text-decoration: none;
  margin-bottom: .7rem;
}

.post-hero .post-category a:hover {
  background: var(--coral-dark);
  color: #fff !important;
}

.post-hero-title {
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-weight: 900;
  color: #ffffff;
  line-height: 1.3;
  margin: 0 0 .8rem;
  letter-spacing: -.02em;
  text-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.post-hero-excerpt {
  font-size: .9rem;
  color: rgba(255,255,255,.8);
  line-height: 1.65;
  margin-bottom: .9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 575.98px) {
  .post-hero-excerpt { display: none; }
}

.post-hero-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: .75rem;
  color: rgba(255,255,255,.6);
}

.post-hero-read {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--coral-mid);
  font-weight: 600;
  font-size: .8rem;
  letter-spacing: .03em;
}

/* ============================================
   ④ 文章卡片 (首頁網格)
   ============================================ */

.card {
  background: var(--card) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: var(--r-md) !important;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition:
    box-shadow var(--t-mid) var(--ease),
    transform  var(--t-mid) var(--ease),
    border-color var(--t-mid) var(--ease);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: var(--border) !important;
}

.card.is-featured { border-top: 3px solid var(--coral) !important; }

.card-body {
  padding: 1.1rem 1.15rem .75rem !important;
}

.card-footer {
  background: var(--bg) !important;
  border-top: 1px solid var(--border-light) !important;
  padding: .5rem 1.15rem !important;
}

/* 圖片 */
.card-img-top,
figure.card-img-top {
  border-radius: 0 !important;
  overflow: hidden;
  margin: 0;
  display: block;
}

.card-img-top img,
figure.card-img-top img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  transition: transform var(--t-slow) var(--ease);
}

.card:hover .card-img-top img,
.card:hover figure.card-img-top img { transform: scale(1.04); }

.overlay.overlay-1 { position: relative; overflow: hidden; display: block; }
.media-placeholder { background: var(--border-light); }

/* ─── 分類標籤 ─── */
.post-category { margin-bottom: .45rem; }

.post-category a,
.text-line a {
  display: inline-block;
  font-size: .64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .13em;
  color: var(--coral) !important;
  border: 1px solid var(--coral-line);
  background: var(--coral-pale);
  padding: .1rem .5rem;
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: all var(--t-fast) var(--ease);
}

.post-category a:hover {
  background: var(--coral) !important;
  border-color: var(--coral) !important;
  color: #fff !important;
}

/* ─── 卡片標題 ─── */
.blog.grid .post-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
  margin: .15rem 0 .4rem !important;
}

.blog.grid .post-title a,
.blog.grid .post-title .link-dark {
  color: var(--ink) !important;
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}

.blog.grid .post-title a:hover,
.blog.grid .post-title .link-dark:hover { color: var(--coral) !important; }

/* 摘要 */
.card-body .post-content p {
  font-size: .845rem;
  color: var(--secondary);
  line-height: 1.7;
  margin-bottom: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Meta */
.post-meta {
  list-style: none;
  padding: 0; margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .2rem .6rem;
}

.post-meta li { display: flex; align-items: center; }

.post-meta a, .post-meta span {
  font-size: .72rem;
  color: var(--muted);
  text-decoration: none;
}

.post-meta a:hover { color: var(--coral); }
.post-meta i { font-size: .8rem; margin-right: .2rem; color: var(--faint); }

/* 進場動畫 */
@keyframes heroIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.blog.grid .row > [class*='col-'] {
  animation: cardIn .45s var(--ease) both;
}

.blog.grid .row > [class*='col-']:nth-child(1)  { animation-delay: .05s; }
.blog.grid .row > [class*='col-']:nth-child(2)  { animation-delay: .10s; }
.blog.grid .row > [class*='col-']:nth-child(3)  { animation-delay: .15s; }
.blog.grid .row > [class*='col-']:nth-child(4)  { animation-delay: .20s; }
.blog.grid .row > [class*='col-']:nth-child(5)  { animation-delay: .24s; }
.blog.grid .row > [class*='col-']:nth-child(n+6){ animation-delay: .28s; }

/* ============================================
   ⑤ 分頁
   ============================================ */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  margin: 2.5rem 0 1rem;
  flex-wrap: wrap;
}

.pagination .btn {
  background: var(--card);
  border: 1px solid var(--border) !important;
  color: var(--body) !important;
  border-radius: var(--r-sm) !important;
  padding: .38rem 1.1rem;
  font-size: .82rem;
  font-family: var(--f);
  box-shadow: var(--shadow-xs);
  transition: all var(--t-fast) var(--ease);
}

.pagination .btn:hover {
  background: var(--coral) !important;
  border-color: var(--coral) !important;
  color: #fff !important;
  box-shadow: 0 3px 12px rgba(229,92,58,.3);
  transform: translateY(-1px);
}

.pagination .footer-meta { font-size: .78rem; color: var(--muted); }
.infinite-sentinel { text-align: center; padding: 1.25rem; color: var(--muted); font-size: .82rem; }

/* ============================================
   ⑥ 側邊欄
   ============================================ */

@media (min-width: 992px) {
  .sidebar {
    padding-left: 2.25rem !important;
    border-left: 1px solid var(--divider);
  }
}

.widget { margin-bottom: 2.25rem; }

.widget-title {
  font-family: var(--f);
  font-size: .67rem !important;
  font-weight: 700;
  color: var(--ink) !important;
  text-transform: uppercase;
  letter-spacing: .15em;
  padding-bottom: .55rem;
  margin-bottom: 1rem !important;
  border-bottom: 1px solid var(--border) !important;
  position: relative;
}

.widget-title::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 2rem;
  height: 2px;
  background: var(--coral);
}

/* Search */
.search-form .form-control,
.form-floating .form-control {
  background: var(--card);
  border: 1px solid var(--border) !important;
  border-radius: var(--r-sm) !important;
  font-family: var(--f);
  font-size: .875rem;
  color: var(--body);
  padding: .6rem .85rem !important;
  height: auto !important;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

.search-form .form-control:focus,
.form-floating .form-control:focus {
  border-color: var(--coral) !important;
  box-shadow: 0 0 0 3px rgba(229,92,58,.15) !important;
  outline: none;
}

.form-floating label { font-size: .85rem; color: var(--muted); padding: .6rem .85rem !important; }

.widget p.mb-0 { font-size: .875rem; color: var(--secondary); line-height: 1.75; }

/* Sidebar post list */
.sidebar .post-content {
  display: flex;
  gap: .7rem;
  padding-bottom: .9rem;
  margin-bottom: .9rem;
  border-bottom: 1px solid var(--border-light);
}

.sidebar .post-content:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.sidebar .post-content figure.rounded {
  flex-shrink: 0;
  width: 66px; height: 52px;
  margin: 0;
  border-radius: var(--r-sm);
  overflow: hidden;
}

.sidebar .post-content figure.rounded img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--t-mid) var(--ease);
}

.sidebar .post-content figure.rounded:hover img { transform: scale(1.06); }
.sidebar .post-content > div { flex: 1; min-width: 0; }

.sidebar .post-content .fs-17 {
  font-size: .82rem !important;
  font-weight: 600;
  line-height: 1.45;
  margin: 0 0 .25rem !important;
}

.sidebar .post-content .fs-17 a.link-dark { color: var(--ink) !important; text-decoration: none; }
.sidebar .post-content .fs-17 a.link-dark:hover { color: var(--coral) !important; }

/* Tag cloud */
.tag-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: .4rem;
}

.tag-list li a,
.btn.btn-soft-ash,
.btn.btn-soft-leaf {
  display: inline-flex;
  align-items: center;
  padding: .2rem .65rem !important;
  font-size: .72rem; font-family: var(--f);
  border-radius: 100px !important;
  border: 1px solid var(--border) !important;
  background: var(--card) !important;
  color: var(--secondary) !important;
  text-decoration: none;
  transition: all var(--t-fast) var(--ease);
  line-height: 1.5;
}

.tag-list li a:hover,
.btn.btn-soft-ash:hover,
.btn.btn-soft-leaf:hover {
  border-color: var(--coral) !important;
  color: var(--coral) !important;
  background: var(--coral-pale) !important;
}

/* Related cats */
.unordered-list.bullet-primary {
  list-style: none; padding: 0; margin: 0;
}

.unordered-list.bullet-primary li {
  padding: .3rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: .85rem;
}

.unordered-list.bullet-primary li:last-child { border-bottom: none; }
.unordered-list.bullet-primary li a { color: var(--secondary); text-decoration: none; }
.unordered-list.bullet-primary li a:hover { color: var(--coral); }

/* ============================================
   ⑦ 文章頁
   ============================================ */

.blog.single .card {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

.blog.single .card:hover { transform: none !important; box-shadow: none !important; }
.blog.single .card-body { padding: 0 !important; }

/* Article header */
.blog.single .post-header {
  padding-bottom: 1.25rem !important;
  border-bottom: 1px solid var(--divider) !important;
  margin-bottom: 2rem !important;
}

/* H1 */
.blog.single .display-4 {
  font-family: var(--f);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 900;
  line-height: 1.38;
  color: var(--ink);
  letter-spacing: -.02em;
  margin-bottom: 1rem !important;
}

.blog.single .display-4 a { color: inherit; text-decoration: none; }

/* Reading time badge (injected by JS) */
.reading-time-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .7rem;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: 100px;
  padding: .18rem .6rem;
  font-weight: 500;
}

/* ─── TOC (目錄，JS 注入) ─── */
.article-toc {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--coral);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  font-size: .85rem;
}

.article-toc-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  margin-bottom: .6rem;
}

.article-toc ol {
  list-style: none;
  margin: 0; padding: 0;
  counter-reset: toc-counter;
}

.article-toc li {
  counter-increment: toc-counter;
  padding: .2rem 0;
  border-bottom: 1px solid var(--divider);
}

.article-toc li:last-child { border-bottom: none; }

.article-toc a {
  color: var(--secondary);
  text-decoration: none;
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  line-height: 1.45;
  transition: color var(--t-fast) var(--ease);
}

.article-toc a::before {
  content: counter(toc-counter, decimal-leading-zero);
  font-size: .65rem;
  font-weight: 700;
  color: var(--coral);
  flex-shrink: 0;
  margin-top: .1rem;
  font-variant-numeric: tabular-nums;
  min-width: 1.4em;
}

.article-toc a:hover { color: var(--coral); }

.article-toc a.active { color: var(--coral); font-weight: 600; }

/* ─── 文章內容 ─── */
.article {
  font-family: var(--f);
  font-size: 1rem;
  line-height: 1.9;
  color: var(--body);
}

.article p { margin-bottom: 1.15rem; }

.article h2, .article h3, .article h4 {
  font-family: var(--f);
  color: var(--ink);
  font-weight: 700;
  margin-top: 2.2rem;
  margin-bottom: .8rem;
  letter-spacing: -.01em;
}

.article h2 {
  font-size: 1.35rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border-light);
  position: relative;
}

.article h2::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 2.5rem;
  height: 2px;
  background: var(--coral);
}

.article h3 { font-size: 1.1rem; }
.article h4 { font-size: 1rem; }

.article a {
  color: var(--coral);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--coral-line);
  text-decoration-thickness: 1px;
}

.article a:hover { color: var(--coral-dark); text-decoration-color: var(--coral-dark); }

.article img {
  max-width: 100%;
  height: auto;
  border-radius: var(--r-sm);
  display: block;
  margin: 1.5rem auto;
  box-shadow: var(--shadow-sm);
}

.article blockquote {
  border-left: 3px solid var(--coral);
  padding: .9rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--coral-pale);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--secondary);
}

.article blockquote p:last-child { margin-bottom: 0; }

.article code {
  font-family: var(--mono);
  font-size: .855em;
  background: var(--border-light);
  color: var(--coral-dark);
  padding: .15em .4em;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.article pre {
  background: var(--navy-1);
  color: #cdd9e5;
  border-radius: var(--r-md);
  padding: 1.25rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: .875rem;
  line-height: 1.65;
  margin: 1.5rem 0;
}

.article pre code {
  background: transparent; color: inherit;
  padding: 0; border: none; font-size: inherit;
}

.article ul, .article ol { padding-left: 1.6rem; margin-bottom: 1rem; }
.article li { margin-bottom: .35rem; }

.article table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: .9rem;
  display: block;
  overflow-x: auto;
}

.article th {
  background: var(--bg);
  font-weight: 700;
  text-align: left;
  padding: .6rem 1rem;
  border-bottom: 2px solid var(--border);
  color: var(--ink);
  font-size: .83rem;
}

.article td {
  padding: .5rem 1rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}

.article tr:hover td { background: var(--coral-pale); }

/* ============================================
   ⑧ 文章頁 prev/next + 相關文章
   ============================================ */

.post-footer {
  margin-top: 2.5rem !important;
  padding-top: 1.5rem;
  border-top: 1px solid var(--divider);
}

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .85rem;
  margin: 2.5rem 0;
  padding-top: 2rem;
  border-top: 1px solid var(--divider);
}

.post-nav a {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--body);
  transition: all var(--t-mid) var(--ease);
}

.post-nav a:hover {
  border-color: var(--coral);
  box-shadow: 0 4px 16px rgba(229,92,58,.18);
  transform: translateY(-2px);
}

.post-nav a:last-child { text-align: right; }

.post-nav .label {
  font-size: .67rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--coral);
  font-weight: 700;
  margin-bottom: .35rem;
}

.post-nav .title {
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 相關文章 */
.blog.single section.wrapper.bg-light {
  background: var(--bg) !important;
  border-radius: var(--r-lg);
  border: 1px solid var(--divider);
  padding: 2rem !important;
  margin-top: 2.5rem;
}

.blog.single section.wrapper.bg-light h2 {
  font-size: .68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .15em;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 1.5rem !important;
}

.blog.single section.wrapper.bg-light .container { padding: 0 !important; }

/* ============================================
   ⑨ 閱讀進度條
   ============================================ */

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--coral) 0%, var(--coral-mid) 100%);
  width: 0%;
  z-index: 1300;
  transition: width .1s linear;
  pointer-events: none;
  box-shadow: 0 0 8px rgba(229,92,58,.5);
}

/* ============================================
   ⑩ 頁尾
   ============================================ */

footer.bg-dark {
  background: var(--navy-1) !important;
  border-top: 2px solid var(--coral);
}

.site-footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2.5rem;
  padding: 3rem 0 2rem;
}

@media (max-width: 767.98px) {
  .site-footer-grid { grid-template-columns: 1fr; gap: 1.5rem; padding: 2rem 0 1.5rem; }
}

.footer-brand-name {
  display: block;
  font-size: 1.2rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: -.02em;
  margin-bottom: .5rem;
  text-decoration: none;
}

.footer-brand-name::after { content: '.'; color: var(--coral); }

.site-footer-grid p {
  font-size: .85rem;
  color: #6A8BAD;
  line-height: 1.7;
  margin-bottom: .75rem;
}

.footer-social {
  display: flex;
  gap: .5rem;
  margin-top: .75rem;
}

.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--navy-4);
  color: #6A8BAD !important;
  font-size: .95rem;
  transition: all var(--t-fast) var(--ease);
}

.footer-social a:hover { border-color: var(--coral); color: var(--coral) !important; background: rgba(229,92,58,.1); }

.footer-col-title {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: #8B9AAD;
  margin-bottom: .85rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--navy-3);
}

.footer-col-links {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: .4rem;
}

.footer-col-links li a {
  font-size: .85rem;
  color: #6A8BAD !important;
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}

.footer-col-links li a:hover { color: var(--coral-mid) !important; }

.footer-bottom {
  border-top: 1px solid var(--navy-3);
  padding: 1.25rem 0;
  text-align: center;
  font-size: .75rem;
  color: #445E7A;
}

/* 覆蓋舊 Bootstrap footer widget */
footer .widget { margin-bottom: 0; }
footer .widget-title { display: none; }
footer .list-unstyled { display: none; }
footer details { display: none; }
footer .col-md-6 p.mb-2,
footer .col-md-6 p.mb-0 { display: none; }

/* ============================================
   ⑪ 全域 Buttons
   ============================================ */

.btn {
  font-family: var(--f);
  font-size: .82rem;
  letter-spacing: .02em;
}

.btn-soft-ash, .btn-soft-leaf {
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  color: var(--secondary) !important;
  border-radius: 100px !important;
}

.btn-soft-ash:hover, .btn-soft-leaf:hover {
  background: var(--coral-pale) !important;
  border-color: var(--coral) !important;
  color: var(--coral) !important;
}

/* ============================================
   ⑫ Lazy image / Back to top
   ============================================ */

img.lazy-img { opacity: 0; transition: opacity .35s ease; }
img.lazy-img.loaded,
img.lazy-img.is-loaded { opacity: 1; }

#back-to-top {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  width: 38px; height: 38px;
  background: var(--coral);
  color: #fff;
  border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(229,92,58,.4);
  opacity: 0; transform: translateY(8px);
  transition: opacity var(--t-mid) var(--ease), transform var(--t-mid) var(--ease), background var(--t-fast) var(--ease);
  z-index: 900;
}

#back-to-top.visible { opacity: 1; transform: translateY(0); }
#back-to-top:hover { background: var(--coral-dark); }

/* ============================================
   ⑬ RWD
   ============================================ */

@media (max-width: 991.98px) {
  .mobile-menu-toggle { display: flex; }
  .site-nav-list .desktop-only { display: none; }

  .blog.single .display-4 { font-size: 1.55rem; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav a:last-child { text-align: left; }
}

@media (max-width: 767.98px) {
  .blog.single .display-4 { font-size: 1.3rem; }
  .article h2 { font-size: 1.15rem; }
  .card-body { padding: .9rem 1rem .6rem !important; }
}

/* ============================================
   ⑭ 列表頁 Classic View（分類 / 下載清單）
   ============================================ */

/* 頁面標題列 */
.classic-page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.1rem;
  border-bottom: 2px solid var(--divider);
  position: relative;
}

.classic-page-header::before {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 3rem;
  height: 2px;
  background: var(--coral);
}

.classic-page-title {
  font-size: clamp(1.35rem, 2.5vw, 1.8rem);
  font-weight: 900;
  color: var(--ink);
  letter-spacing: -.02em;
  margin: 0 0 .25rem;
  line-height: 1.3;
}

.classic-page-meta {
  font-size: .8rem;
  color: var(--muted);
  margin: 0;
}

/* 文章圖片（classic-view 內） */
.blog.classic-view figure.rounded {
  border-radius: 0 !important;
  overflow: hidden;
  margin: 0;
  display: block;
}

.blog.classic-view figure.rounded img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  transition: transform var(--t-slow) var(--ease);
}

.blog.classic-view .card:hover figure.rounded img {
  transform: scale(1.03);
}

/* 文章標題 */
.blog.classic-view .post-title {
  font-size: 1.1rem !important;
  font-weight: 700;
  line-height: 1.5;
  margin: 0 0 .3rem !important;
}

.blog.classic-view .post-title a.link-dark {
  color: var(--ink) !important;
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}

.blog.classic-view .post-title a.link-dark:hover {
  color: var(--coral) !important;
}

/* 摘要 */
.blog.classic-view p.text-muted {
  font-size: .875rem !important;
  color: var(--secondary) !important;
  line-height: 1.7;
}

/* ============================================
   ⑮ 分類索引頁
   ============================================ */

.category-index-section {
  margin-top: 1.5rem;
}

.category-index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: .85rem;
  margin-top: 1.25rem;
}

.category-index-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .9rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--body);
  font-size: .9rem;
  font-weight: 600;
  transition: all var(--t-mid) var(--ease);
  line-height: 1.4;
}

.category-index-item:hover {
  border-color: var(--coral);
  color: var(--coral) !important;
  background: var(--coral-pale);
  box-shadow: 0 3px 12px rgba(229,92,58,.12);
  transform: translateY(-2px);
}

.category-index-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--coral-pale);
  border-radius: 50%;
  flex-shrink: 0;
  transition: background var(--t-fast) var(--ease);
  font-size: .85rem;
  font-weight: 700;
  color: var(--coral);
  line-height: 1;
}

.category-index-item:hover .category-index-dot {
  background: var(--coral);
  color: #fff;
}

/* ============================================
   ⑯ 標籤文章列表頁 (tag.php)
   ============================================ */

/* 標籤頁標題 */
.tag-page-header {
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--divider);
}

.tag-page-title {
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
  font-weight: 900;
  color: var(--ink);
  letter-spacing: -.02em;
  margin: 0 0 .4rem;
  line-height: 1.3;
  text-decoration: none !important;
}

.tag-page-title:hover { color: var(--coral) !important; }

.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--coral);
  background: var(--coral-pale);
  border: 1px solid var(--coral-line);
  border-radius: 100px;
  padding: .18rem .7rem;
  margin-bottom: .6rem;
}

/* 熱門搜尋 / 相關標籤 行 */
.tag-keyword-row {
  margin-bottom: 1.25rem;
}

/* Grid 文章卡片 (tag.php 內) */
figure.rounded.hover-scale,
figure.hover-scale {
  border-radius: 0 !important;
  overflow: hidden;
  margin: 0;
  display: block;
}

figure.rounded.hover-scale img,
figure.hover-scale img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  transition: transform var(--t-slow) var(--ease);
}

.card:hover figure.hover-scale img,
.card:hover figure.rounded.hover-scale img {
  transform: scale(1.04);
}

/* grid-view 卡片內標題 */
.grid-view .card-body h2 {
  font-size: .92rem !important;
  font-weight: 700;
  line-height: 1.45;
  margin: 0 0 .4rem !important;
  color: var(--ink) !important;
}

.grid-view .card-body h2 a,
.grid-view .card-body h2 a.link-dark {
  color: var(--ink) !important;
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}

.grid-view .card-body h2 a:hover { color: var(--coral) !important; }

.grid-view .card-body p {
  font-size: .8rem;
  color: var(--secondary) !important;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0;
}

/* ============================================
   ⑰ 標籤總覽頁 (tag_index.php)
   ============================================ */

.tag-index-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--divider);
}

.tag-index-title {
  font-size: 1.65rem;
  font-weight: 900;
  color: var(--ink);
  letter-spacing: -.025em;
  margin: 0 0 .25rem;
}

.tag-index-title .accent { color: var(--coral); }

/* 熱門搜尋 / 標籤雲區塊標題 */
.tag-section-label {
  font-size: .67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .15em;
  color: var(--muted);
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.tag-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

/* 標籤顆粒（帶計數） */
.tag-list a .badge {
  background: var(--bg) !important;
  color: var(--muted) !important;
  font-size: .65rem;
  border-radius: 100px;
  padding: .1rem .35rem;
  border: 1px solid var(--border-light);
}

.tag-list a:hover .badge {
  background: var(--coral-pale) !important;
  color: var(--coral) !important;
  border-color: var(--coral-line) !important;
}

/* ============================================
   ⑱ 分頁（標籤頁 Bootstrap pagination）
   ============================================ */

nav[aria-label="pagination"] .pagination {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  list-style: none;
  padding: 0;
  margin: 2rem 0 1rem;
  justify-content: center;
}

nav[aria-label="pagination"] .page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 .65rem;
  font-size: .82rem;
  font-family: var(--f);
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--body);
  border-radius: var(--r-sm);
  transition: all var(--t-fast) var(--ease);
  text-decoration: none;
}

nav[aria-label="pagination"] .page-item.active .page-link {
  background: var(--coral);
  border-color: var(--coral);
  color: #fff;
  pointer-events: none;
}

nav[aria-label="pagination"] .page-item.disabled .page-link {
  opacity: .35;
  pointer-events: none;
  cursor: default;
}

nav[aria-label="pagination"] .page-link:hover {
  background: var(--coral-pale);
  border-color: var(--coral-line);
  color: var(--coral);
}

/* ============================================
   ⑲ 共用 Utility（Sandbox 相容）
   ============================================ */

.fs-13 { font-size: .8125rem !important; }
.fs-14 { font-size: .875rem !important; }
.fs-18 { font-size: 1.125rem !important; }
.ls-xl { letter-spacing: .04em !important; }
.text-navy { color: var(--navy-2) !important; }
.text-leaf { color: var(--coral) !important; }
.bg-soft-leaf { background: var(--coral-pale) !important; }

/* 舊格式 badge（tag_index.php） */
.badge.bg-soft-leaf {
  background: var(--coral-pale) !important;
  color: var(--coral) !important;
  font-weight: 600;
  border: 1px solid var(--coral-line);
}

@media (max-width: 767.98px) {
  .category-index-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar { padding-left: 0 !important; border-left: none; }
}
