/* Hexo Butterfly Theme Style for HSUCHE Portfolio */
:root {
  --bg: #f4f6f9;
  --card-bg: #ffffff;
  --ink: #1f2d3d;
  --ink-2: #4c596a;
  --ink-3: #8a96a3;
  --line: #e3e8f7;
  --acc: #49b1f5;
  --acc-2: #2d8cf0;
  --acc-soft: #eaf4fe;
  --shadow: 0 4px 14px rgba(7, 10, 25, 0.06);
  --shadow-h: 0 12px 30px rgba(7, 10, 25, 0.14);
  --radius: 12px;
  --radius-lg: 16px;
  --navbar-bg: rgba(255, 255, 255, 0.88);
}

[data-theme="dark"] {
  --bg: #121824;
  --card-bg: #1d2536;
  --ink: #e2e8f0;
  --ink-2: #94a3b8;
  --ink-3: #64748b;
  --line: #2b364c;
  --acc: #38bdf8;
  --acc-2: #0ea5e9;
  --acc-soft: rgba(56, 189, 248, 0.15);
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  --shadow-h: 0 12px 32px rgba(0, 0, 0, 0.55);
  --navbar-bg: rgba(29, 37, 54, 0.88);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; overflow-x: hidden; max-width: 100%; }
body { width: 100%; max-width: 100%; overflow-x: hidden; background: var(--bg); color: var(--ink); font: 15px/1.8 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif; transition: background 0.3s ease, color 0.3s ease; }
a { color: inherit; text-decoration: none; transition: color 0.2s ease; }
img, video, canvas { display: block; max-width: 100%; height: auto; }
iframe { max-width: 100%; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: middle; }

/* ── 導覽列（Butterfly 玻璃擬態固定列） ── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 64px;
  color: #fff;
  background: linear-gradient(180deg, rgba(8, 14, 26, 0.82) 0%, rgba(8, 14, 26, 0.4) 65%, rgba(8, 14, 26, 0) 100%);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
  transition: background 0.3s ease, box-shadow 0.3s ease, color 0.3s ease, height 0.3s ease;
}
.navbar.solid {
  background: var(--navbar-bg);
  color: var(--ink);
  text-shadow: none;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  height: 60px;
}
.nav-inner {
  max-width: 1240px;
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-sizing: border-box;
}
.brand {
  font-weight: 800;
  letter-spacing: 0.14em;
  font-size: 18px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  white-space: nowrap;
  flex: none;
}
.brand span {
  font-weight: 400;
  letter-spacing: 0.06em;
  font-size: 13px;
  opacity: 0.85;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: none;
}
.nav-menu {
  display: flex;
  gap: 20px;
  font-size: 14.5px;
  font-weight: 600;
}
.nav-menu a {
  opacity: 0.92;
  padding: 4px 6px;
  border-radius: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}
.nav-menu a:hover {
  color: var(--acc);
  opacity: 1;
}

.nav-btn {
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14.5px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  opacity: 0.92;
  transition: all 0.2s;
  white-space: nowrap;
}
.nav-btn:hover {
  color: var(--acc);
  opacity: 1;
  background: rgba(255, 255, 255, 0.14);
}
.navbar.solid .nav-btn:hover {
  background: var(--acc-soft);
}
.mobile-menu-btn {
  display: none;
}

/* ── 橫幅（Hero Banner） ── */
.banner {
  position: relative;
  background: #0f1b2d center / cover no-repeat;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 14, 26, 0.4) 0%, rgba(8, 14, 26, 0.75) 100%);
  pointer-events: none;
}

.home-banner {
  height: 100vh;
  min-height: 520px;
  text-align: center;
  background-image: radial-gradient(circle at 50% 30%, #1e3a5f 0%, #0d1b2a 70%);
}
.home-banner .banner-text {
  position: relative;
  z-index: 2;
  padding: 0 20px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}
.home-banner h1 {
  margin: 0 auto;
  font-size: clamp(34px, 8vw, 68px);
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  font-weight: 800;
  text-align: center;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  max-width: 100%;
}
.typewriter-wrap {
  margin-top: 16px;
  font-size: clamp(16px, 2.8vw, 24px);
  min-height: 40px;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.08em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  text-align: center;
}
.typed-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: #fff;
  margin-left: 4px;
  animation: blink 0.9s infinite;
  vertical-align: middle;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.list-banner {
  height: 320px;
  text-align: center;
}
.list-banner .banner-text {
  position: relative;
  z-index: 1;
}
.list-banner h1 {
  font-size: clamp(28px, 4.5vw, 42px);
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}
.list-banner p {
  margin-top: 8px;
  font-size: 16px;
  opacity: 0.9;
}

.post-banner {
  min-height: 380px;
  height: 46vh;
  max-height: 480px;
  align-items: flex-end;
}
.post-banner::before {
  content: "";
  position: absolute;
  inset: -10px;
  background: linear-gradient(
    180deg,
    rgba(8, 14, 26, 0.78) 0%,
    rgba(8, 14, 26, 0.58) 40%,
    rgba(8, 14, 26, 0.94) 100%
  );
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 1;
  pointer-events: none;
}
.post-banner .banner-text {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px 44px;
  position: relative;
  z-index: 2;
  box-sizing: border-box;
}
.post-banner h1 {
  font-size: clamp(22px, 3.8vw, 38px);
  line-height: 1.35;
  max-width: 960px;
  color: #ffffff;
  font-weight: 800;
  word-break: break-word;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.8), 0 1px 3px rgba(0, 0, 0, 0.95);
}
.post-banner .meta {
  color: rgba(255, 255, 255, 0.94);
  margin-top: 14px;
  font-size: 14px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
}
.post-banner .meta a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.scroll-down { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); font-size: 32px; line-height: 1; opacity: 0.85; z-index: 2; animation: bob 1.8s ease-in-out infinite; color: #fff; }
@keyframes bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 8px); } }

/* ── 主版面架構 ── */
.layout { max-width: 1240px; margin: 0 auto; padding: 38px 20px 64px; display: grid; gap: 24px; }
@media (min-width: 960px) { .layout { grid-template-columns: minmax(0, 1fr) 310px; } }
.card { background: var(--card-bg); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 24px; margin-bottom: 24px; border: 1px solid var(--line); transition: box-shadow 0.3s ease, border-color 0.3s ease; }
.card-title { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font-size: 16px; font-weight: 700; color: var(--ink); border-bottom: 1.5px solid var(--line); padding-bottom: 10px; }

/* ── 分頁篩選按鈕 ── */
.tabs { display: flex; gap: 10px; margin-bottom: 22px; }
.tabs button { border: 1px solid var(--line); background: var(--card-bg); box-shadow: var(--shadow); border-radius: 999px; padding: 7px 22px; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; transition: all 0.25s; }
.tabs button:hover { color: var(--acc); border-color: var(--acc); }
.tabs button.on { background: var(--acc); color: #fff; border-color: var(--acc); box-shadow: 0 4px 14px rgba(73, 177, 245, 0.35); }

/* ── 文章列表卡片（Butterfly 左右交錯與縮放動效） ── */
.post-card { display: flex; background: var(--card-bg); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 24px; min-height: 250px; border: 1px solid var(--line); transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease; }
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-h); border-color: rgba(73, 177, 245, 0.4); }
.post-card.reverse { flex-direction: row-reverse; }
.post-card .cover { width: 45%; flex: none; overflow: hidden; background: #12243b; position: relative; }
.post-card .cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1); }
.post-card:hover .cover img { transform: scale(1.08); }
.post-card .info { padding: 30px 36px; display: flex; flex-direction: column; justify-content: center; min-width: 0; flex: 1; }
.post-card .title { font-size: 21px; font-weight: 700; line-height: 1.5; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; transition: color 0.2s; }
.post-card .title:hover { color: var(--acc); }
.post-card .excerpt { margin: 12px 0 0; color: var(--ink-2); font-size: 14px; line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pin { display: inline-flex; align-items: center; gap: 4px; color: #ef4444; font-size: 13.5px; font-weight: 700; margin-right: 8px; vertical-align: 1px; }
.pin svg { width: 14px; height: 14px; }
.post-card.hide { display: none; }

/* ── 中繼資訊 ── */
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 13px; color: var(--ink-3); align-items: center; }
.meta span { display: inline-flex; align-items: center; gap: 6px; }
.meta .tags a + a::before { content: "·"; margin: 0 5px; opacity: 0.6; }
.meta a:hover { color: var(--acc); }

/* ── 側邊欄（Butterfly 作者卡、分類、標籤、歸檔） ── */
.aside { display: flex; flex-direction: column; }
.profile { text-align: center; padding: 28px 24px; }
.avatar { width: 104px; height: 104px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; font-size: 42px; font-weight: 300; color: #fff; background: linear-gradient(135deg, #1e3a5f, #14706b); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15); transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1); }
.avatar:hover { transform: rotate(360deg); }
.profile h3 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: 0.08em; }
.profile-bio { margin: 8px 0 16px; font-size: 14px; color: var(--ink-2); line-height: 1.6; }
.counts { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 18px; font-size: 13px; color: var(--ink-2); border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); padding: 10px 0; }
.counts b { display: block; font-size: 20px; font-weight: 700; color: var(--ink); line-height: 1.2; }
.btn { display: block; background: var(--acc); color: #fff; border-radius: 8px; padding: 8px 0; font-size: 14.5px; font-weight: 600; text-align: center; box-shadow: 0 4px 12px rgba(73, 177, 245, 0.3); transition: all 0.2s; }
.btn:hover { background: var(--acc-2); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(73, 177, 245, 0.4); }

.cat-list { list-style: none; margin: 0; padding: 0; }
.cat-list li { margin: 4px 0; }
.cat-list a { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-radius: 6px; font-size: 14px; color: var(--ink-2); transition: all 0.2s; }
.cat-list a:hover { background: var(--acc-soft); color: var(--acc-2); padding-left: 14px; }
.cat-list em { font-style: normal; font-size: 12px; color: var(--ink-3); background: rgba(0, 0, 0, 0.05); padding: 2px 8px; border-radius: 999px; }
[data-theme="dark"] .cat-list em { background: rgba(255, 255, 255, 0.1); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.tag-cloud a { color: var(--ink-2); transition: all 0.2s; }
.tag-cloud a:hover { color: var(--acc); transform: scale(1.08); }
.tag-cloud.big { gap: 10px; margin-bottom: 26px; }
.tag-cloud.big a { background: var(--acc-soft); color: var(--acc-2); border-radius: 999px; padding: 4px 14px; font-size: 14px; font-weight: 500; }
.tag-cloud.big em { font-style: normal; font-size: 12px; margin-left: 5px; opacity: 0.75; }

.mini-post { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.mini-post:last-child { border-bottom: 0; }
.mini-post img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex: none; transition: transform 0.3s; }
.mini-post:hover img { transform: scale(1.06); }
.mini-post b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13.5px; font-weight: 600; line-height: 1.5; color: var(--ink); }
.mini-post time { font-size: 12px; color: var(--ink-3); margin-top: 2px; display: block; }
.mini-post:hover b { color: var(--acc); }

/* ── 目錄（TOC） ── */
@media (min-width: 960px) { .post .aside .toc { position: sticky; top: 80px; } }
.toc nav { max-height: calc(100vh - 220px); overflow-y: auto; font-size: 13.5px; }
.toc a { display: block; padding: 5px 10px; border-left: 2.5px solid transparent; color: var(--ink-2); line-height: 1.5; border-radius: 0 4px 4px 0; transition: all 0.2s; }
.toc a.l3 { padding-left: 22px; font-size: 13px; }
.toc a.on { color: var(--acc-2); border-left-color: var(--acc); background: var(--acc-soft); font-weight: 600; }
.toc .progress { margin-left: auto; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.toc-toggle { display: none; background: transparent; border: 0; color: var(--ink-3); font-size: 12px; cursor: pointer; margin-left: 8px; }

/* ── 文章內文 ── */
.article { padding: 36px 44px; }
.content h2 { font-size: 23px; line-height: 1.45; margin: 38px 0 16px; padding-left: 14px; border-left: 4px solid var(--acc); color: var(--ink); }
.content h3 { font-size: 18.5px; margin: 30px 0 12px; color: var(--ink); }
.content h2:first-child, .content > :first-child { margin-top: 0; }
.content p { margin: 10px 0 16px; font-size: 15.5px; line-height: 1.85; color: var(--ink); }
.content ul, .content ol { padding-left: 24px; margin: 10px 0 16px; }
.content li { margin: 6px 0; font-size: 15px; color: var(--ink); }
.content table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; display: block; overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.content th, .content td { padding: 11px 14px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.content th { background: rgba(0, 0, 0, 0.03); font-weight: 700; }
[data-theme="dark"] .content th { background: rgba(255, 255, 255, 0.05); }

pre, code, .code {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
pre, .code {
  background: rgba(0, 0, 0, 0.04);
  padding: 14px 18px;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre;
  word-wrap: normal;
  border: 1px solid var(--line);
  margin: 14px 0 18px;
}
[data-theme="dark"] pre, [data-theme="dark"] .code {
  background: rgba(0, 0, 0, 0.35);
}
.content .callout { background: var(--acc-soft); border-left: 4px solid var(--acc); padding: 14px 18px; border-radius: 8px; margin: 20px 0; font-size: 14.5px; }
.content .callout.warn { background: #fffbeb; border-color: #f59e0b; color: #92400e; }
[data-theme="dark"] .content .callout.warn { background: rgba(245, 158, 11, 0.15); color: #fde68a; }

.copyright { margin-top: 32px; padding: 16px 20px; border-left: 4px solid var(--acc); background: var(--acc-soft); border-radius: 8px; font-size: 14px; display: flex; flex-direction: column; color: var(--ink-2); }
.copyright b { color: var(--ink); font-size: 15px; margin-bottom: 2px; }

/* ── 相關文章（Related Posts） ── */
.related-posts { margin-top: 26px; margin-bottom: 16px; }
.related-title { font-size: 18px; font-weight: 700; color: var(--ink); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.related-card { background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: all 0.25s ease; display: flex; flex-direction: column; }
.related-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-h); border-color: var(--acc); }
.related-cover { height: 110px; overflow: hidden; background: #12243b; }
.related-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.related-card:hover .related-cover img { transform: scale(1.06); }
.related-info { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.related-info time { font-size: 12px; color: var(--ink-3); margin-bottom: 4px; display: block; }
.related-info b { font-size: 14px; font-weight: 600; line-height: 1.45; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.related-card:hover .related-info b { color: var(--acc); }

/* ── 上下篇導航 ── */
.pn-wrap { display: grid; gap: 16px; margin-top: 14px; }
@media (min-width: 760px) { .pn-wrap { grid-template-columns: 1fr 1fr; } }
.pn { position: relative; display: block; height: 130px; border-radius: var(--radius-lg); overflow: hidden; color: #fff; background: #0f172a; box-shadow: var(--shadow); }
.pn img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.5; transition: transform 0.6s, opacity 0.3s; }
.pn:hover img { transform: scale(1.06); opacity: 0.35; }
.pn span { position: relative; display: flex; flex-direction: column; justify-content: center; height: 100%; padding: 0 24px; z-index: 2; }
.pn.next span { text-align: right; }
.pn small { opacity: 0.85; font-size: 12.5px; }
.pn b { font-weight: 700; line-height: 1.45; font-size: 16px; }

/* ── 專案展演與圖片 ── */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 22px; }
.shots figure { margin: 0; }
.shots img { border-radius: 8px; border: 1px solid var(--line); aspect-ratio: 16 / 10; object-fit: cover; width: 100%; }
.shots figcaption { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; line-height: 1.5; }

.demo-poster { position: relative; display: block; border-radius: 12px; overflow: hidden; margin-bottom: 20px; background: #070b14; box-shadow: var(--shadow); }
.demo-poster img { width: 100%; opacity: 0.8; transition: opacity 0.3s, transform 0.6s; }
.demo-poster:hover img { opacity: 0.6; transform: scale(1.02); }
.demo-poster span { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--acc); color: #fff; border-radius: 999px; padding: 12px 24px; font-size: 15px; font-weight: 700; white-space: nowrap; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); }

.content .page-shot { margin: 18px 0 26px; }
.content .page-shot img { width: 100%; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.content .page-shot figcaption { font-size: 13px; color: var(--ink-3); margin-top: 6px; }

.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(8, 14, 26, 0.9); overflow: auto; padding: 56px 16px 32px; cursor: zoom-out; backdrop-filter: blur(8px); }
.lightbox img { display: block; margin: 0 auto; width: auto; max-width: min(1600px, 100%); height: auto; border-radius: 8px; cursor: default; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6); }
.lightbox button { position: fixed; top: 16px; right: 20px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.9); color: #1f2a37; font-size: 28px; line-height: 44px; cursor: pointer; transition: transform 0.2s; }
.lightbox button:hover { transform: scale(1.1); }

/* ── 列表頁（分類、標籤、時間軸、工具） ── */
.list-card { padding: 32px 36px; }
.list-card section + section { margin-top: 30px; }
.list-card h2 { font-size: 21px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; border-bottom: 1.5px solid var(--line); padding-bottom: 8px; color: var(--ink); }
.list-card h2 em { font-style: normal; font-size: 13px; color: var(--ink-3); font-weight: 400; margin-left: 6px; }
.row { display: flex; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px dashed var(--line); transition: padding-left 0.2s; }
.row:hover { padding-left: 6px; }
.row img { width: 90px; height: 60px; object-fit: cover; border-radius: 8px; flex: none; }
.row time { display: block; font-size: 12.5px; color: var(--ink-3); }
.row b { font-weight: 600; font-size: 15px; color: var(--ink); }
.row:hover b { color: var(--acc); }
.row small { display: block; font-size: 13px; color: var(--ink-3); line-height: 1.6; }

.timeline { border-left: 3px solid var(--acc-soft); padding-left: 20px; }
.timeline h2 { margin-left: -29px; border-bottom: 0; }
.timeline h2::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--acc); background: #fff; flex: none; }
[data-theme="dark"] .timeline h2::before { background: var(--card-bg); }
.arch-total { margin: 0 0 22px; color: var(--ink-2); font-size: 15px; }

/* ── 工具頁 ── */
@media (min-width: 960px) { .layout.wide { grid-template-columns: minmax(0, 1fr); } }
.tool .back { display: inline-block; font-size: 14px; color: var(--ink-3); margin-bottom: 14px; }
.tool .back:hover { color: var(--acc); }

/* ── 頁尾 ── */
.site-foot { text-align: center; padding: 40px 20px; color: #e5ecf5; background: linear-gradient(135deg, #09131f 0%, #10263e 50%, #123e4d 100%); font-size: 14px; letter-spacing: 0.06em; line-height: 1.8; }
.foot-sub { font-size: 13px; opacity: 0.75; margin-top: 4px; }

/* ── 右下角浮動按鈕（Butterfly Rightside） ── */
.rightside { position: fixed; right: 24px; bottom: 28px; z-index: 90; display: flex; flex-direction: column; gap: 10px; }
.rs-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--card-bg); color: var(--ink); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1); cursor: pointer; display: grid; place-items: center; transition: all 0.25s ease; position: relative; }
.rs-btn:hover { background: var(--acc); color: #fff; transform: translateY(-3px); box-shadow: 0 8px 20px rgba(73, 177, 245, 0.4); border-color: var(--acc); }
.rs-btn svg { width: 18px; height: 18px; }
#theme-btn .icon-moon { display: none; }
[data-theme="dark"] #theme-btn .icon-sun { display: none; }
[data-theme="dark"] #theme-btn .icon-moon { display: block; }
#to-top-btn { opacity: 0; pointer-events: none; transition: opacity 0.3s ease, transform 0.25s ease; }
#to-top-btn.show { opacity: 1; pointer-events: auto; }
#to-top-btn .scroll-percent { font-size: 11px; font-weight: 700; line-height: 1; }
#to-top-btn .icon-arrow-up { display: none; }
#to-top-btn:hover .scroll-percent { display: none; }
#to-top-btn:hover .icon-arrow-up { display: block; }

/* ── 站內搜尋彈窗（Butterfly Search Modal） ── */
.search-modal { position: fixed; inset: 0; z-index: 150; display: flex; align-items: flex-start; justify-content: center; padding-top: 10vh; opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
.search-modal.active { opacity: 1; pointer-events: auto; }
.search-mask { position: absolute; inset: 0; background: rgba(8, 14, 26, 0.65); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.search-dialog { position: relative; z-index: 2; width: 92%; max-width: 640px; max-height: 80vh; background: var(--card-bg); border-radius: var(--radius-lg); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35); border: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; transform: scale(0.95); transition: transform 0.25s ease; }
.search-modal.active .search-dialog { transform: scale(1); }

.search-header { display: flex; align-items: center; padding: 18px 22px; border-bottom: 1.5px solid var(--line); gap: 14px; background: rgba(0, 0, 0, 0.02); }
.search-input-wrap { display: flex; align-items: center; gap: 12px; flex: 1; }
.search-input-wrap svg { width: 20px; height: 20px; color: var(--acc); }
.search-input-wrap input { width: 100%; border: 0; background: transparent; font-size: 16px; color: var(--ink); outline: none; }
.search-close { background: transparent; border: 0; font-size: 26px; line-height: 1; color: var(--ink-3); cursor: pointer; padding: 0 4px; transition: color 0.2s; }
.search-close:hover { color: var(--acc); }

.search-results { padding: 14px 22px; overflow-y: auto; max-height: calc(80vh - 80px); }
.search-empty { text-align: center; padding: 40px 0; color: var(--ink-3); font-size: 15px; }
.search-item { display: block; padding: 14px 12px; border-radius: 8px; border-bottom: 1px dashed var(--line); transition: background 0.2s; }
.search-item:last-child { border-bottom: 0; }
.search-item:hover { background: var(--acc-soft); }
.search-item-title { font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.search-item:hover .search-item-title { color: var(--acc-2); }
.search-item-excerpt { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-item-tags { display: flex; gap: 8px; margin-top: 6px; }
.search-tag-pill { font-size: 11.5px; background: rgba(0, 0, 0, 0.05); color: var(--ink-3); padding: 1px 8px; border-radius: 999px; }
[data-theme="dark"] .search-tag-pill { background: rgba(255, 255, 255, 0.1); }
.search-highlight { color: #ef4444; font-weight: 700; }

/* ── 手機響應式（<= 768px 與 <= 480px / 375px） ── */
@media (max-width: 768px) {
  .navbar { height: 56px; }
  .nav-inner { padding: 0 16px; }
  .brand { font-size: 17px; }
  .nav-right { gap: 8px; }
  .nav-menu { display: none; }
  .mobile-menu-btn { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border-radius: 8px; }
  .search-btn { padding: 6px 10px; font-size: 13.5px; }

  .navbar.menu-open .nav-menu {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--card-bg);
    padding: 16px 20px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--line);
    gap: 10px;
    animation: menuSlideDown 0.22s ease-out;
  }
  .navbar.menu-open .nav-menu a {
    color: var(--ink);
    font-size: 15px;
    padding: 8px 12px;
    border-radius: 8px;
    display: block;
    text-shadow: none;
  }
  .navbar.menu-open .nav-menu a:hover {
    background: var(--acc-soft);
    color: var(--acc-2);
  }
  @keyframes menuSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .layout { padding: 20px 12px 48px; gap: 18px; }
  .post-card, .post-card.reverse { flex-direction: column; min-height: auto; }
  .post-card .cover { width: 100%; height: 200px; }
  .post-card .info { padding: 18px 16px; }
  .post-card .title { font-size: 18px; }

  .card { padding: 18px 16px; border-radius: 12px; }
  .article { padding: 20px 14px; }
  .content { word-break: break-word; }
  .content h2 { font-size: 20px; margin: 28px 0 14px; padding-left: 10px; }
  .content h3 { font-size: 17px; margin: 24px 0 10px; }
  .content p, .content li { font-size: 15px; }
  .content table { font-size: 13px; }
  .content th, .content td { padding: 8px 10px; }

  .post-banner { height: 320px; min-height: 280px; }
  .post-banner .banner-text { padding: 0 16px 24px; }
  .post-banner h1 { font-size: clamp(20px, 5.5vw, 26px); }

  .toc-toggle { display: inline-block; }
  .toc.collapsed nav { display: none; }
  .rightside { right: 14px; bottom: 18px; }
  .rs-btn { width: 40px; height: 40px; }
}

@media (max-width: 480px) {
  .brand span { display: none; }
  .search-btn span { display: none; }
  .search-btn { padding: 6px 8px; }
  .home-banner h1 {
    font-size: clamp(28px, 9vw, 40px);
    letter-spacing: 0.12em;
    text-indent: 0.12em;
  }
  .typewriter-wrap {
    font-size: 14.5px;
    letter-spacing: 0.03em;
    min-height: 32px;
  }
  .counts b { font-size: 17px; }
  .post-card .cover { height: 170px; }
}
