:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-muted: #eef3f7;
  --text: #1c2430;
  --muted: #667085;
  --line: #dce3eb;
  --teal: #0f766e;
  --blue: #2563eb;
  --amber: #b45309;
  --rose: #be123c;
  --green: #15803d;
  --shadow: 0 14px 35px rgba(28, 36, 48, 0.09);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", Arial, sans-serif;
  line-height: 1.7;
}

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

button,
input {
  font: inherit;
}

img,
iframe {
  max-width: 100%;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: var(--radius);
  background: #111827;
  color: white;
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #344054;
  font-size: 14px;
}

.header-nav a {
  padding: 9px 12px;
  border-radius: var(--radius);
}

.header-nav a:hover,
.header-nav a:focus-visible {
  background: var(--surface-muted);
  outline: none;
}

.app {
  min-height: calc(100vh - 72px);
}

.page-heading {
  border-bottom: 1px solid var(--line);
  background: white;
}

.page-heading-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 22px 0;
}

.page-heading h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: 0;
}

.page-heading p {
  margin: 4px 0 0;
  color: #485467;
  font-size: 15px;
}

.btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: #111827;
  color: white;
  cursor: pointer;
  font-weight: 700;
  padding: 0 16px;
}

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

.btn:hover {
  transform: translateY(-1px);
}

.compact-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.content-band {
  padding: 24px 0 56px;
}

.category-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: #344054;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  padding: 9px 12px;
}

.chip.is-active,
.chip:hover {
  border-color: #111827;
  background: #111827;
  color: white;
}

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

.section-title h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.3;
}

.section-title p {
  margin: 4px 0 0;
  color: var(--muted);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.category-card,
.doc-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 8px 24px rgba(28, 36, 48, 0.05);
}

.category-card {
  display: flex;
  min-height: 138px;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
}

.category-card:hover,
.doc-card:hover {
  border-color: #b8c5d4;
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.category-card h3,
.doc-card h3 {
  margin: 0;
  line-height: 1.35;
}

.category-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.category-meta,
.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.doc-card {
  display: grid;
  min-height: 100%;
  overflow: hidden;
}

.doc-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #dce3eb;
}

.doc-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 200ms ease;
}

.doc-card:hover .doc-thumb img {
  transform: scale(1.025);
}

.doc-thumb-fallback {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.18), transparent 58%),
    #f2f5f8;
  color: #344054;
  font-weight: 800;
}

.play-badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: grid;
  width: 44px;
  height: 32px;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(17, 24, 39, 0.88);
  color: white;
  font-size: 12px;
  font-weight: 800;
}

.doc-body {
  padding: 16px;
}

.doc-body p {
  display: -webkit-box;
  margin: 10px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius);
  background: #eef3f7;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 6px 8px;
}

.tag.teal {
  background: rgba(15, 118, 110, 0.11);
  color: var(--teal);
}

.tag.blue {
  background: rgba(37, 99, 235, 0.11);
  color: var(--blue);
}

.tag.amber {
  background: rgba(180, 83, 9, 0.12);
  color: var(--amber);
}

.layout {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  gap: 24px;
  padding: 28px 0 56px;
}

.sidebar {
  position: sticky;
  top: 92px;
  align-self: start;
  max-height: calc(100vh - 110px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 14px;
}

.sidebar h2 {
  margin: 6px 0 12px;
  font-size: 15px;
}

.sidebar-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidebar-list a {
  display: block;
  border-radius: var(--radius);
  color: #344054;
  font-size: 14px;
  line-height: 1.45;
  padding: 9px 10px;
}

.sidebar-list a:hover,
.sidebar-list a.is-active {
  background: var(--surface-muted);
  color: #111827;
}

.article-shell {
  min-width: 0;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 14px;
}

.breadcrumb a {
  color: var(--blue);
}

.article-header {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 28px;
  box-shadow: 0 8px 24px rgba(28, 36, 48, 0.05);
}

.article-header h1 {
  margin: 0;
  font-size: clamp(28px, 3.2vw, 44px);
  line-height: 1.2;
  letter-spacing: 0;
}

.article-summary {
  margin: 14px 0 0;
  color: #485467;
}

.article-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.video-section,
.article-content,
.empty-state {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(28, 36, 48, 0.05);
}

.video-section h2,
.article-content h2 {
  margin-top: 0;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.video-frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: #101828;
  aspect-ratio: 16 / 9;
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.article-content {
  overflow-wrap: anywhere;
}

.article-content > *:first-child {
  margin-top: 0;
}

.article-content h2,
.article-content h3,
.article-content h4 {
  margin: 28px 0 10px;
  line-height: 1.35;
}

.article-content p,
.article-content li {
  color: #344054;
}

.article-content a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-content figure {
  margin: 20px 0;
}

.article-content img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: zoom-in;
}

.article-content ol,
.article-content ul {
  padding-left: 1.4em;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
}

.article-content th,
.article-content td {
  border: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.article-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.article-nav a {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 14px;
}

.article-nav span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.article-nav strong {
  display: block;
  margin-top: 4px;
  line-height: 1.45;
}

.footer-band {
  border-top: 1px solid var(--line);
  background: #111827;
  color: white;
  padding: 24px 0;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
}

.empty-state {
  text-align: center;
}

.empty-state h2 {
  margin: 0;
}

.empty-state p {
  color: var(--muted);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(17, 24, 39, 0.84);
  padding: 24px;
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-height: 86vh;
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.lightbox-close {
  position: fixed;
  top: 20px;
  right: 20px;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  color: white;
  cursor: pointer;
  padding: 0 12px;
}

@media (max-width: 980px) {
  .page-heading-inner,
  .layout,
  .category-grid,
  .doc-grid {
    grid-template-columns: 1fr;
  }

  .compact-stats {
    justify-content: flex-start;
  }

  .sidebar {
    position: static;
    max-height: none;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 22px, 1180px);
  }

  .header-inner {
    min-height: auto;
    flex-direction: column;
    align-items: stretch;
    padding: 12px 0;
  }

  .header-nav {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .page-heading-inner {
    padding: 18px 0;
  }

  .page-heading h1 {
    font-size: 24px;
  }

  .article-nav {
    grid-template-columns: 1fr;
  }

  .section-title {
    display: block;
  }

  .article-header,
  .video-section,
  .article-content {
    padding: 18px;
  }
}
