/* ===== Design tokens ===== */
:root {
  --bg: #fbfbfd;
  --bg-alt: #f3f3f7;
  --surface: #ffffff;
  --text: #16161d;
  --text-soft: #545465;
  --text-faint: #8a8a9a;
  --border: #e7e7ee;
  --border-strong: #d8d8e3;
  --accent: #5b5bd6;
  --accent-2: #8b5cf6;
  --accent-soft: #efeffe;
  --shadow: 0 1px 2px rgba(20, 20, 40, .04), 0 8px 24px rgba(20, 20, 40, .06);
  --shadow-hover: 0 2px 4px rgba(20, 20, 40, .06), 0 16px 40px rgba(20, 20, 40, .12);
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1120px;
}

[data-theme="dark"] {
  --bg: #0e0e14;
  --bg-alt: #14141d;
  --surface: #181822;
  --text: #f1f1f6;
  --text-soft: #b4b4c4;
  --text-faint: #7e7e92;
  --border: #262633;
  --border-strong: #34343f;
  --accent: #8b8bf0;
  --accent-2: #a78bfa;
  --accent-soft: #1d1d2e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, .4), 0 16px 40px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  font-family: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  transition: background .3s ease, color .3s ease;
}

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

/* ===== Nav ===== */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 20px;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 900; font-size: 1.15rem; letter-spacing: -.01em;
}
.brand-mark {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
  padding: 7px 13px; border-radius: 999px; font-size: .92rem;
  color: var(--text-soft); font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.nav-links a:hover { background: var(--accent-soft); color: var(--accent); }
.theme-toggle {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-soft); cursor: pointer;
  transition: border-color .15s ease, color .15s ease, transform .1s ease;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle:active { transform: scale(.94); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ===== Hero ===== */
.hero {
  position: relative; overflow: hidden;
  padding: 96px 24px 80px;
  text-align: center;
  background:
    radial-gradient(60% 120% at 50% -10%, var(--accent-soft) 0%, transparent 60%);
}
.hero-inner { max-width: 780px; margin: 0 auto; }
.eyebrow {
  display: inline-block; font-weight: 700; font-size: .82rem;
  letter-spacing: .08em; color: var(--accent);
  background: var(--accent-soft); padding: 5px 13px; border-radius: 999px;
  margin-bottom: 22px;
}
.hero h1 {
  font-size: clamp(2.6rem, 7vw, 4.4rem); font-weight: 900;
  letter-spacing: -.03em; line-height: 1.05; margin-bottom: 22px;
  background: linear-gradient(135deg, var(--text) 30%, var(--accent) 120%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { font-size: clamp(1rem, 2.2vw, 1.2rem); color: var(--text-soft); margin-bottom: 30px; }
.hero-meta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 999px; font-size: .9rem; font-weight: 600;
  background: var(--accent); color: #fff; transition: transform .12s ease, opacity .15s ease;
}
.pill:hover { opacity: .92; }
.pill-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.pill-ghost:hover { border-color: var(--accent); color: var(--accent); }

.hero-stats {
  display: flex; gap: 14px; justify-content: center; flex-wrap: wrap;
  margin-top: 48px;
}
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px 22px; min-width: 116px;
  box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 1.7rem; font-weight: 900; letter-spacing: -.02em; color: var(--accent); }
.stat span { font-size: .82rem; color: var(--text-faint); }

/* ===== Sections ===== */
.section { max-width: var(--maxw); margin: 0 auto; padding: 76px 24px; }
.section-alt { max-width: none; background: var(--bg-alt); }
.section-alt > * { max-width: var(--maxw); margin-left: auto; margin-right: auto; }
.section-head { margin-bottom: 36px; }
.section-head h2 {
  font-size: clamp(1.7rem, 4vw, 2.3rem); font-weight: 900;
  letter-spacing: -.02em; margin-bottom: 8px;
}
.section-head > p { color: var(--text-soft); max-width: 620px; }

/* ===== Toolbar / search ===== */
.toolbar { margin-top: 22px; }
.search {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 10px 18px; width: min(420px, 100%);
  color: var(--text-faint); transition: border-color .15s ease, box-shadow .15s ease;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); color: var(--accent); }
.search input {
  border: none; outline: none; background: transparent; flex: 1;
  font: inherit; font-size: .95rem; color: var(--text);
}

/* ===== Tool groups ===== */
.tool-group { margin-bottom: 44px; }
.tool-group:last-child { margin-bottom: 0; }
.tool-group-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.tool-group-head h3 { font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; }
.tool-group-head p { color: var(--text-faint); font-size: .9rem; }

.grid { display: grid; gap: 18px; }
.grid-tools { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.grid-skills { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-resources { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.grid-authors { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* ===== Cards ===== */
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
a.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--border-strong); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card h4 { font-size: 1.12rem; font-weight: 800; letter-spacing: -.01em; }
.card .by { font-size: .82rem; color: var(--text-faint); margin-top: 2px; }
.card p { color: var(--text-soft); font-size: .94rem; flex: 1; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  font-size: .74rem; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); padding: 3px 9px; border-radius: 999px;
}
.go {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .85rem; font-weight: 700; color: var(--accent); white-space: nowrap;
}
a.card:hover .go { gap: 7px; }
.go svg { transition: transform .15s ease; }

.meta-chip {
  font-size: .74rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap;
}
.cost-chip {
  font-size: .74rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: color-mix(in srgb, #16a34a 14%, transparent); color: #16a34a; white-space: nowrap;
}
[data-theme="dark"] .cost-chip { color: #4ade80; }

/* ===== Skills ===== */
.skill-card .skill-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.skill-num {
  display: grid; place-items: center; width: 30px; height: 30px; flex: none;
  border-radius: 8px; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-weight: 800; font-size: .9rem;
}

/* ===== Timeline / news ===== */
.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: var(--border-strong);
}
.tl-item { position: relative; margin-bottom: 22px; }
.tl-item:last-child { margin-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -26px; top: 24px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--bg-alt);
}
.tl-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.tl-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.tl-date { font-size: .82rem; font-weight: 700; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.tl-tag { font-size: .72rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 2px 9px; border-radius: 999px; }
.tl-card h4 { font-size: 1.18rem; font-weight: 800; margin-bottom: 8px; letter-spacing: -.01em; }
.tl-card p { color: var(--text-soft); font-size: .95rem; }
.tl-card .go { margin-top: 14px; }

/* ===== Note ===== */
.note {
  margin-top: 26px; padding: 16px 20px; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--accent);
  font-size: .92rem; font-weight: 600;
}
.no-result { text-align: center; color: var(--text-faint); padding: 30px; }

/* ===== Sources ===== */
.sources-list { list-style: none; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.sources-list a {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-soft); font-size: .88rem; padding: 8px 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  transition: color .15s ease, border-color .15s ease;
}
.sources-list a:hover { color: var(--accent); border-color: var(--accent); }
.sources-list svg { flex: none; opacity: .6; }

/* ===== Footer ===== */
.footer { border-top: 1px solid var(--border); background: var(--bg-alt); padding: 48px 24px; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; text-align: center; }
.footer-brand { font-weight: 900; font-size: 1.1rem; margin-bottom: 8px; }
.footer-note { color: var(--text-soft); font-size: .9rem; max-width: 560px; margin: 0 auto 8px; }
.footer-update { color: var(--text-faint); font-size: .82rem; }

/* ===== Responsive ===== */
@media (max-width: 760px) {
  .nav-links { display: none; }
  .hero { padding: 64px 20px 56px; }
  .section { padding: 56px 20px; }
}
