:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --ink: #1f2433;
  --muted: #5d6576;
  --line: #e7e2d8;
  --brand: #262b63;
  --brand-deep: #181b45;
  --accent: #0e7c7b;
  --gold: #c9a227;
  --radius: 14px;
  --gutter: clamp(16px, 5vw, 32px);
  --content: 720px;
  --wide: 1080px;
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.8;
  /* 長網址、長英文字不會把版面撐破 */
  overflow-wrap: anywhere;
}

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

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--brand); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -9999px; top: 8px;
  background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 10;
}
.skip-link:focus { left: 8px; }

.container {
  width: 100%;
  max-width: calc(var(--content) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide { max-width: calc(var(--wide) + var(--gutter) * 2); }

/* ── 頁首 ───────────────────────────── */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 68px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink); text-decoration: none; }
.brand-mark { flex: none; width: 36px; height: 36px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.brand-name { font-weight: 700; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-en { font-size: .72rem; color: var(--muted); letter-spacing: .02em; }
.site-nav { display: flex; gap: 4px; flex: none; }
.site-nav a {
  color: var(--ink); text-decoration: none; font-size: .95rem;
  padding: 6px 10px; border-radius: 8px;
}
.site-nav a:hover { background: #f1eee7; color: var(--brand); }

/* ── 首頁 HERO ───────────────────────── */
.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  min-height: clamp(380px, 68vh, 600px);
  overflow: hidden;
  background: var(--brand-deep);
  color: #fff;
}
.hero-img {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100%; max-width: none;
  object-fit: cover; object-position: 50% 35%;
}
.hero-shade {
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(24, 27, 69, .10) 0%, rgba(24, 27, 69, .55) 50%, rgba(24, 27, 69, .92) 100%);
}
.hero-content { padding-block: 56px 48px; }
.hero-kicker {
  margin: 0 0 8px; color: var(--gold);
  font-size: .85rem; font-weight: 700; letter-spacing: .12em;
}
.hero h1 { margin: 0; font-size: clamp(2rem, 7.5vw, 3.6rem); line-height: 1.2; letter-spacing: .06em; }
.hero-en { margin: 6px 0 0; font-size: clamp(.9rem, 2.6vw, 1.1rem); opacity: .85; letter-spacing: .04em; }
.hero-lead { margin: 18px 0 24px; max-width: 34em; font-size: clamp(1rem, 2.8vw, 1.15rem); }

.button {
  display: inline-block;
  background: var(--gold); color: var(--brand-deep);
  font-weight: 700; text-decoration: none;
  padding: 10px 22px; border-radius: 999px;
}
.button:hover { background: #dcb640; color: var(--brand-deep); }

/* ── 區塊與文章卡片 ───────────────────── */
.section { padding-block: 56px 16px; }
.section:last-child { padding-bottom: 64px; }
.section h2 { margin: 0 0 12px; font-size: clamp(1.4rem, 4.5vw, 1.8rem); letter-spacing: .04em; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 20px; }
.section-head h2 { margin: 0; }
.section-head p { margin: 0; color: var(--muted); font-size: .9rem; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 20px;
}
.card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(31, 36, 51, .08); }
.card-title { margin: 0 0 8px; font-size: 1.2rem; line-height: 1.5; }
.card-title a { color: var(--ink); text-decoration: none; }
.card-title a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); } /* 整張卡片都可點 */
.card:hover .card-title a { color: var(--brand); }
.card-desc { margin: 0 0 14px; color: var(--muted); font-size: .95rem; flex: 1; }
.empty { color: var(--muted); }

.meta {
  display: flex; flex-wrap: wrap; gap: 4px 16px;
  margin: 0; padding: 0; list-style: none;
  color: var(--muted); font-size: .85rem; line-height: 1.6;
}
.meta-label { color: var(--accent); font-weight: 700; margin-right: 2px; }
.meta time, .views { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ── 文章頁 ─────────────────────────── */
.post { padding-block: 28px 64px; }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--muted); }
.post-header h1 { margin: 0 0 12px; font-size: clamp(1.6rem, 6vw, 2.4rem); line-height: 1.35; letter-spacing: .02em; }

/* 文章首圖：等比例縮放，寬度不超過內文區 */
.post-hero { margin: 24px 0 8px; }
.post-hero img { width: 100%; height: auto; border-radius: var(--radius); }
.post-hero figcaption { margin-top: 6px; font-size: .8rem; color: var(--muted); text-align: right; }

.prose { margin-top: 24px; }
.prose > :first-child { margin-top: 0; }
.prose h2 { margin: 2.2em 0 .6em; font-size: 1.4rem; line-height: 1.45; padding-left: 12px; border-left: 4px solid var(--gold); }
.prose h3 { margin: 1.8em 0 .5em; font-size: 1.15rem; }
.prose p { margin: 1em 0; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: .35em 0; }
.prose blockquote {
  margin: 1.4em 0; padding: 12px 18px;
  background: #f3f0e8; border-left: 4px solid var(--accent); border-radius: 0 10px 10px 0;
  color: #3b4252;
}
.prose blockquote p { margin: .4em 0; }
.prose img { width: 100%; height: auto; border-radius: 10px; }
.prose pre { overflow-x: auto; background: #1f2433; color: #f3f4f8; padding: 14px 16px; border-radius: 10px; font-size: .9rem; }
.prose code { font-size: .92em; background: #efece4; padding: .1em .35em; border-radius: 4px; }
.prose pre code { background: none; padding: 0; }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }

.back-link { margin-top: 40px; }
.not-found { text-align: center; padding-block: 80px; }

/* ── 頁尾 ───────────────────────────── */
.site-footer { background: var(--brand-deep); color: #c9cce0; font-size: .85rem; line-height: 1.7; padding-block: 36px; }
.site-footer a { color: #fff; }
.footer-name { margin: 0 0 16px; color: #fff; font-weight: 700; font-size: 1rem; letter-spacing: .04em; }
.footer-name span { color: var(--gold); font-weight: 400; margin-left: 6px; }
.credits h2 { margin: 0 0 4px; font-size: .85rem; color: var(--gold); letter-spacing: .08em; }
.credits ul { margin: 0 0 16px; padding: 0; list-style: none; }
.copyright { margin: 0; opacity: .75; }

/* ── 手機 ───────────────────────────── */
@media (max-width: 600px) {
  body { font-size: 16px; }
  .header-inner { min-height: 60px; }
  .brand-mark { width: 32px; height: 32px; }
  .site-nav a { padding: 6px 8px; }
  .hero-content { padding-block: 40px 32px; }
  .section { padding-top: 40px; }
  .card { padding: 18px 18px 14px; }
}
@media (max-width: 380px) {
  .brand-en { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card { transition: none; }
}
