:root {
  --brand: #2b59ff;
  --brand-dark: #1f3fb6;
  --ink: #0f172a;
  --muted: #475569;
  --line: #e2e8f0;
  --bg: #ffffff;
  --soft: #f8fafc;
  --green: #2f5d50;
  --gold: #c8a96a;
  --radius: 18px;
  --shadow: 0 14px 34px rgba(2, 8, 23, .08);
  --container: 1120px;
  --knowledge-hero-image: url("../images/hero-background.jpg");
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  overflow-x: hidden;
}

.no-scroll {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(var(--container), calc(100% - 40px));
  margin: 0 auto;
}

header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  border-bottom: 1px solid transparent;
  background: transparent;
  transition: background-color .32s ease, border-color .32s ease, box-shadow .32s ease, backdrop-filter .32s ease;
}

header.is-scrolled,
header.is-menu-open {
  border-bottom-color: var(--line);
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 10px 30px rgba(2, 8, 23, .06);
  backdrop-filter: blur(10px);
}

@supports (animation-timeline: scroll()) {
  header {
    animation: headerScrollFill linear both;
    animation-timeline: scroll(root);
    animation-range: 72px 73px;
  }

  header.is-menu-open {
    animation: none;
  }

  @keyframes headerScrollFill {
    from {
      background: transparent;
      backdrop-filter: none;
      border-bottom-color: transparent;
      box-shadow: none;
    }

    to {
      background: rgba(255, 255, 255, .9);
      backdrop-filter: blur(10px);
      border-bottom-color: var(--line);
      box-shadow: 0 10px 30px rgba(2, 8, 23, .06);
    }
  }
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
}

.brand img {
  width: 84px;
  height: auto;
}

.brand small {
  display: block;
  color: #64748b;
  font-size: 12px;
}

nav ul {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

nav a {
  font-weight: 800;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 900;
  padding: 0 18px;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow);
}

.btn-secondary {
  border-color: var(--line);
  background: #fff;
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-weight: 900;
}

.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: none;
  background: rgba(15, 23, 42, .45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}

.nav-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 10000;
  display: none;
  width: min(86vw, 360px);
  height: 100vh;
  flex-direction: column;
  gap: 14px;
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 18px;
  transform: translateX(100%);
  transition: transform .18s ease;
}

.nav-panel a {
  font-weight: 900;
}

.nav-panel .btn {
  width: 100%;
}

.nav-overlay.is-open {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.nav-panel.is-open {
  display: flex;
  transform: translateX(0);
}

main {
  padding-top: 0;
}

.knowledge-hero {
  position: relative;
  min-height: 460px;
  display: grid;
  align-items: end;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .96), rgba(255, 255, 255, .78) 46%, rgba(255, 255, 255, .46)),
    var(--knowledge-hero-image) center / cover no-repeat;
  padding: 144px 0 64px;
}

.hero-content {
  max-width: 760px;
}

.hero-credit {
  position: absolute;
  right: 16px;
  bottom: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  padding: 5px 9px;
}

.hero-credit a {
  color: inherit;
}

.kicker,
.article-category {
  display: inline-flex;
  width: fit-content;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

h1 {
  margin: 12px 0 14px;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1.08;
}

.lead {
  max-width: 740px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.9;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

section {
  padding: 52px 0;
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.section-head h2 {
  margin: 6px 0 0;
  font-size: clamp(24px, 3vw, 34px);
}

.section-head p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.featured-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 18px;
}

.featured-card,
.article-card,
.topic-card,
.cta-band,
.article-shell,
.toc-card,
.article-side-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.featured-card {
  display: grid;
  gap: 16px;
  padding: clamp(22px, 4vw, 34px);
}

.featured-card h2 {
  margin: 0;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.18;
}

.featured-card p,
.article-card p,
.topic-card p {
  color: var(--muted);
  line-height: 1.8;
}

.meta-row,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-row span,
.tag-row span,
.category-filter button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  padding: 6px 10px;
}

.category-panel {
  display: grid;
  gap: 10px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  padding: 18px;
}

.category-panel a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  padding: 12px;
}

.category-panel small {
  color: var(--muted);
}

.category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.category-filter button {
  cursor: pointer;
}

.category-filter button.is-active {
  border-color: #c7d2fe;
  background: #eef2ff;
  color: #1e40af;
}

.article-grid,
.topic-grid,
.related-grid {
  display: grid;
  gap: 16px;
}

.article-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.article-card {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 18px;
}

.article-card h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.35;
}

.article-card p {
  margin: 0;
}

.article-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.topic-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.topic-card {
  padding: 18px;
}

.topic-card h3 {
  margin: 0 0 8px;
}

.topic-card ul {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.cta-band {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 20px;
  background:
    linear-gradient(135deg, rgba(47, 93, 80, .94), rgba(31, 69, 59, .96)),
    var(--green);
  color: #fff;
  padding: clamp(24px, 5vw, 42px);
}

.cta-band p {
  max-width: 680px;
  margin: 8px 0 0;
  color: rgba(255, 255, 255, .76);
  line-height: 1.8;
}

.cta-band .btn-secondary {
  border-color: rgba(255, 255, 255, .36);
  background: rgba(255, 255, 255, .1);
  color: #fff;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.article-hero {
  position: relative;
  min-height: 520px;
  display: grid;
  align-items: end;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .96), rgba(255, 255, 255, .8) 48%, rgba(255, 255, 255, .5)),
    var(--knowledge-hero-image) center / cover no-repeat;
  padding: 144px 0 56px;
}

.article-hero h1 {
  max-width: 860px;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}

.article-shell {
  padding: clamp(22px, 4vw, 40px);
}

.article-content {
  color: #1e293b;
  font-size: 17px;
  line-height: 2;
}

.article-content h2 {
  margin: 36px 0 10px;
  font-size: 28px;
  line-height: 1.25;
}

.article-content h3 {
  margin: 24px 0 8px;
  font-size: 21px;
}

.article-content p {
  margin: 0 0 18px;
}

.article-content ul,
.article-content ol {
  display: grid;
  gap: 8px;
  padding-left: 24px;
}

.article-content blockquote {
  margin: 24px 0;
  border-left: 4px solid var(--gold);
  background: #fffbeb;
  padding: 14px 18px;
}

.content-figure {
  margin: 28px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.content-figure img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: cover;
}

.content-figure figcaption {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  padding: 10px 14px;
}

.inline-cta {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(47, 93, 80, .26);
  border-radius: var(--radius);
  background: #eef3ef;
  padding: 18px;
}

.article-aside {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 14px;
}

.toc-card,
.article-side-card {
  padding: 16px;
}

.toc-card strong,
.article-side-card strong {
  display: block;
  margin-bottom: 10px;
}

.toc-card a {
  display: block;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.7;
  padding: 5px 0;
}

.faq-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.faq-list details {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 14px 16px;
}

.faq-list summary {
  cursor: pointer;
  font-weight: 900;
}

.faq-list div {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.8;
}

.related-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

footer {
  border-top: 1px solid #cbd5d1;
  background: linear-gradient(180deg, #eef3ef 0%, #dce7e1 100%);
  color: #334155;
  padding: 34px 0;
}

.footer-row {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 28px;
  align-items: start;
}

.footer-name {
  color: var(--ink);
  font-weight: 900;
}

.footer-desc {
  max-width: 520px;
  margin: 8px 0;
  line-height: 1.8;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.footer-links a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-cta {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.dot {
  opacity: .6;
}

@media (max-width: 980px) {
  .nav-desktop {
    display: none;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .featured-grid,
  .article-layout,
  .footer-row,
  .cta-band {
    grid-template-columns: 1fr;
  }

  .article-aside {
    position: static;
  }

  .article-grid,
  .topic-grid,
  .related-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-links,
  .footer-cta {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .container {
    width: min(100% - 28px, var(--container));
  }

  .brand img {
    width: 56px;
  }

  main {
    padding-top: 0;
  }

  .knowledge-hero {
    min-height: auto;
    padding: 112px 0 42px;
  }

  .article-hero {
    min-height: auto;
    padding: 112px 0 42px;
  }

  .hero-credit {
    position: static;
    width: fit-content;
    margin: 16px auto 0;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }

  .article-grid,
  .topic-grid,
  .related-grid {
    grid-template-columns: 1fr;
  }
}
