:root {
  color-scheme: dark;
  --bg: #090b0d;
  --surface: #11161a;
  --surface-soft: #1b2429;
  --ink: #f4f7f5;
  --muted: #a5aea9;
  --line: #273136;
  --primary: #6fd7b0;
  --primary-strong: #a4f1d0;
  --accent: #f0b55f;
  --amber: #f2c46d;
  --blue: #8cc7ff;
  --shadow: 0 22px 56px rgb(0 0 0 / 36%);
  --radius: 8px;
  --font-sans: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 0%, rgb(111 215 176 / 10%), transparent 34%),
    linear-gradient(180deg, #0d1114 0%, var(--bg) 46%);
  color: var(--ink);
  font-family: var(--font-sans);
  letter-spacing: 0;
}

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

.site-header {
  min-height: 360px;
  background:
    linear-gradient(120deg, rgb(9 13 15 / 96%), rgb(14 19 22 / 92%)),
    url("https://images.unsplash.com/photo-1515879218367-8466d910aaa4?auto=format&fit=crop&w=1800&q=80");
  background-position: center;
  background-size: cover;
  color: #fff;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 24px;
}

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

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 8px;
  background: rgb(255 255 255 / 8%);
  font-size: 13px;
}

.top-search {
  display: grid;
  width: min(320px, 42vw);
  gap: 7px;
  color: rgb(255 255 255 / 72%);
  font-size: 12px;
  font-weight: 800;
}

.top-search input {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 999px;
  background: rgb(255 255 255 / 8%);
  color: #fff;
  font: inherit;
  font-size: 14px;
  padding: 0 16px;
  backdrop-filter: blur(12px);
}

.top-search input::placeholder {
  color: rgb(255 255 255 / 58%);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(290px, .72fr);
  gap: 42px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 34px 24px 64px;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1 {
  max-width: 790px;
  margin: 0;
  font-size: clamp(34px, 4.4vw, 56px);
  line-height: 1.1;
  text-wrap: pretty;
}

.hero-text {
  max-width: 610px;
  margin: 16px 0 0;
  color: rgb(244 247 245 / 72%);
  font-size: 18px;
  line-height: 1.75;
}

.hero-panel {
  align-self: end;
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 13%);
  border-radius: var(--radius);
  background: rgb(12 17 20 / 72%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-panel div {
  padding: 18px 20px;
  background: rgb(255 255 255 / 4%);
}

.hero-panel span {
  display: block;
  font-size: 25px;
  font-weight: 900;
}

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

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px 72px;
}

.tag-band {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 18px;
  margin-top: -38px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgb(17 22 26 / 94%);
  box-shadow: var(--shadow);
}

.section-label span,
.section-head span {
  display: block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.section-label p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.tag-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: start;
}

.tag-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.tag-button:hover {
  transform: translateY(-1px);
  border-color: rgb(111 215 176 / 70%);
}

.tag-button.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #07110d;
}

.feature-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, .42fr);
  gap: 24px;
  margin-top: 42px;
}

.section-head {
  margin-bottom: 16px;
}

h2 {
  margin: 5px 0 0;
  font-size: 30px;
  line-height: 1.2;
}

.featured-list,
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.latest-panel {
  align-self: start;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 34px rgb(0 0 0 / 20%);
}

.latest-list {
  display: grid;
  gap: 10px;
}

.latest-item {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0d1215;
  transition: transform .16s ease, border-color .16s ease;
}

.latest-item:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
}

.latest-item span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.latest-item strong {
  font-size: 17px;
  line-height: 1.35;
}

.latest-item small {
  color: var(--muted);
  line-height: 1.55;
}

.all-head {
  margin-top: 44px;
}

.project-card {
  display: grid;
  gap: 16px;
  min-height: 330px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 16px 38px rgb(0 0 0 / 26%);
}

.featured-card {
  min-height: 390px;
  background:
    linear-gradient(180deg, rgb(18 27 29 / 98%), rgb(13 18 21 / 98%));
}

.card-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--primary-strong);
  font-weight: 800;
}

.project-card h3 {
  margin: 0;
  font-size: 25px;
  line-height: 1.26;
}

.project-card h3 a:hover {
  color: var(--primary);
}

.project-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.72;
}

.project-card .subtitle {
  margin: 8px 0 10px;
  color: var(--ink);
  font-weight: 800;
}

.meta-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
}

.meta-list div {
  min-width: 0;
  padding: 10px;
  border-radius: 7px;
  background: #0c1114;
}

.meta-list dt {
  color: var(--muted);
  font-size: 12px;
}

.meta-list dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-weight: 900;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.card-tags span {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgb(140 199 255 / 11%);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.card-actions {
  display: flex;
  gap: 10px;
  align-self: end;
}

.card-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-weight: 900;
}

.card-actions a.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #07110d;
}

.empty-state {
  padding: 36px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgb(17 22 26 / 58%);
  color: var(--muted);
  text-align: center;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 42px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.article-page {
  background:
    radial-gradient(circle at 18% 0%, rgb(111 215 176 / 10%), transparent 32%),
    var(--bg);
  color: var(--ink);
}

.article-header {
  background: #0d1316;
  color: #fff;
}

.article-topbar {
  padding: 18px 24px;
}

.back-link {
  border-bottom: 1px solid rgb(255 255 255 / 38%);
  color: rgb(255 255 255 / 82%);
  font-weight: 800;
}

.article-shell {
  max-width: 980px;
  padding-top: 38px;
  background: transparent;
}

.article-wrap {
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #11161a;
  color: var(--ink);
  box-shadow: 0 22px 56px rgb(0 0 0 / 34%);
}

.article-loading {
  margin: 0;
  color: var(--muted);
}

.article-meta,
.article-actions,
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.article-meta span,
.article-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 800;
}

.article-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-weight: 900;
}

.article-actions a.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #07110d;
}

.article-content {
  color: var(--ink);
}

.article-content h1 {
  max-width: 760px;
  margin: 22px 0 8px;
  color: var(--ink);
  font-size: clamp(34px, 5vw, 58px);
}

.article-content h2 {
  margin: 44px 0 16px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 29px;
}

.article-content h3 {
  margin: 28px 0 12px;
  font-size: 21px;
  color: var(--ink);
}

.article-content p {
  margin: 0 0 16px;
  color: #dce2df;
  font-size: 17px;
  line-height: 1.9;
}

.article-content a {
  color: var(--primary);
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-content code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #1d2529;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92em;
}

.article-content pre {
  overflow: auto;
  padding: 16px;
  border-radius: var(--radius);
  background: #070a0c;
  color: #f7f2e8;
}

.article-content pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.article-table-wrap {
  overflow-x: auto;
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  background: #0c1114;
}

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

.article-content th {
  color: var(--primary-strong);
  font-size: 13px;
}

.article-note {
  color: var(--muted) !important;
  font-size: 14px !important;
}

input:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgb(111 215 176 / 30%);
  outline-offset: 2px;
}

@media (max-width: 920px) {
  .hero,
  .feature-layout,
  .featured-list,
  .project-grid,
  .tag-band {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 42px;
  }

  .hero-panel {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 680px) {
  .topbar,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-search {
    width: 100%;
  }

  .hero-panel,
  .meta-list {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 36px;
  }

  .tag-band {
    margin-top: -28px;
  }

  .article-wrap {
    padding: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* Dark theme hardening: keeps cached or legacy section styles from leaking light surfaces. */
body,
.article-page {
  background-color: var(--bg);
  color: var(--ink);
}

.tag-band,
.latest-panel,
.project-card,
.article-wrap {
  background-color: var(--surface);
  color: var(--ink);
}

.article-page main,
.article-page .site-footer,
.article-content,
.article-content p,
.article-content li {
  color: var(--ink);
}

.latest-item,
.meta-list div,
.article-content table {
  background-color: #0c1114;
}

/* ── Footer Links ── */
.footer-links {
  display: flex;
  gap: 18px;
}

.footer-links a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  transition: color .16s ease;
}

.footer-links a:hover {
  color: var(--primary);
}

/* ── Side Rail Ads Layout ── */
.page-with-rails {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

.page-core {
  min-width: 0;
}

.ad-rail {
  display: none;
  padding: 24px 0;
}

.ad-banner {
  max-width: 1180px;
  margin: 32px auto 16px;
  padding: 0 24px;
}

.ad-banner ins {
  border-radius: var(--radius);
  overflow: hidden;
}

@media (min-width: 1400px) {
  .page-with-rails {
    grid-template-columns: 160px 1fr 160px;
    gap: 12px;
    max-width: 1560px;
    margin: 0 auto;
  }

  .ad-rail {
    display: block;
  }
}

@media (min-width: 1600px) {
  .page-with-rails {
    grid-template-columns: 200px 1fr 200px;
    gap: 20px;
    max-width: 1680px;
  }

  .ad-rail {
    width: 200px;
  }
}

/* ── Legal Pages (Privacy / Terms) ── */
.legal-wrap {
  max-width: 780px;
}

.lang-switch {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.lang-btn {
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  transition: border-color .16s ease, background .16s ease, color .16s ease;
}

.lang-btn:hover {
  border-color: var(--primary);
  color: var(--ink);
}

.lang-btn.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #07110d;
}

.legal-wrap h1 {
  margin: 0 0 4px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.2;
}

.legal-updated {
  margin: 0 0 32px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.legal-wrap h2 {
  margin: 36px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 22px;
}

.legal-wrap p {
  margin: 0 0 14px;
  color: #dce2df;
  font-size: 16px;
  line-height: 1.85;
}

.legal-wrap a {
  color: var(--primary);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-wrap ul {
  margin: 0 0 16px;
  padding-left: 22px;
}

.legal-wrap li {
  margin-bottom: 6px;
  color: #dce2df;
  font-size: 16px;
  line-height: 1.75;
}
