:root {
  --ink: #14202e;
  --muted: #5b6878;
  --line: #e2e7ee;
  --bg: #ffffff;
  --bg-alt: #f5f7fa;
  --navy: #0f2a44;
  --accent: #1f6feb;
  --accent-soft: #e7f0ff;
  --gold: #b7791f;
  --radius: 14px;
  --font: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Heiti TC", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.75; font-size: 16px; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.3; margin: 0; }
p { margin: 0 0 1em; }
b, strong { font-weight: 700; }

.wrap { width: min(1100px, 100% - 40px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); font-size: .92em; }

/* ---- 頂部導覽 ---- */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.9); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { font-weight: 800; font-size: 18px; color: var(--navy); text-decoration: none; letter-spacing: .02em; }
.brand span { margin-left: 6px; font-weight: 600; color: var(--accent); }
.nav { display: flex; gap: 4px; align-items: center; }
.nav a { color: var(--ink); text-decoration: none; padding: 6px 12px; border-radius: 999px; font-size: 15px; }
.nav a:hover { background: var(--bg-alt); }
.nav .nav__cta { background: var(--navy); color: #fff; }
.nav .nav__cta:hover { background: var(--accent); }
.nav-toggle { display: none; font: inherit; font-size: 15px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 14px; color: var(--ink); cursor: pointer; }

/* ---- 首屏 ---- */
.hero { background: linear-gradient(160deg, #f0f5ff 0%, #ffffff 55%); border-bottom: 1px solid var(--line); }
.hero__inner { display: grid; grid-template-columns: 1.4fr 1fr; gap: 56px; align-items: center; padding: 72px 0 80px; }
.eyebrow { color: var(--accent); font-weight: 700; letter-spacing: .04em; margin-bottom: 12px; font-size: 15px; }
.hero h1 { font-size: clamp(32px, 5vw, 52px); font-weight: 800; color: var(--navy); margin-bottom: 18px; }
.hero h1 strong { color: var(--accent); }
.lead { font-size: 18px; color: #334155; max-width: 36em; }
.hero__now { list-style: none; padding: 0; margin: 22px 0 30px; display: flex; flex-wrap: wrap; gap: 10px; }
.hero__now li { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px 14px 4px 12px; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px #dcfce7; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn { display: inline-block; padding: 11px 22px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font-weight: 600; transition: transform .15s, box-shadow .15s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(15,42,68,.12); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.hero__photo { margin: 0; justify-self: center; width: min(340px, 100%); }
.hero__photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 20%; border-radius: 24px; box-shadow: 0 24px 60px rgba(15,42,68,.18); border: 6px solid #fff; }

/* ---- 區塊 ---- */
.section { padding: 80px 0; }
.section--alt { background: var(--bg-alt); border-block: 1px solid var(--line); }
.section__title { font-size: 28px; font-weight: 800; color: var(--navy); margin-bottom: 24px; position: relative; padding-left: 16px; }
.section__title::before { content: ""; position: absolute; left: 0; top: .2em; bottom: .2em; width: 5px; border-radius: 3px; background: var(--accent); }
.section__lead { color: var(--muted); margin-top: -8px; margin-bottom: 28px; }
.grid-2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; }
.cards { display: grid; gap: 16px; align-content: start; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; }
.card h3 { font-size: 18px; color: var(--navy); margin-bottom: 10px; }
.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.sub { font-size: 18px; color: var(--navy); margin: 32px 0 10px; }

/* ---- 經歷時間軸 ---- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 28px; border-left: 2px solid #cbd5e1; display: grid; gap: 28px; }
.timeline li { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; }
.timeline li::before { content: ""; position: absolute; left: -37px; top: 24px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }
.timeline time { font-size: 14px; color: var(--accent); font-weight: 700; }
.timeline h3 { font-size: 19px; margin: 4px 0 6px; color: var(--navy); }
.timeline h3 span { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 10px; }
.timeline p { margin: 0; color: #334155; }

/* ---- 專案 ---- */
.project { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; margin-bottom: 64px; }
.project--flip .project__media { order: 2; }
.project__media img { border-radius: var(--radius); border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(15,42,68,.10); width: 100%; }
.project__media--narrow { justify-self: center; width: min(320px, 100%); }
.project__year { color: var(--accent); font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.project h3 { font-size: 23px; color: var(--navy); margin-bottom: 12px; }
.facts { padding-left: 1.2em; margin: 0 0 16px; }
.facts li { margin-bottom: 4px; }
.link-arrow { font-weight: 700; text-decoration: none; }
.link-arrow::after { content: " →"; }
.link-arrow:hover { text-decoration: underline; }
.specs { margin: 0; display: grid; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.specs div { display: grid; grid-template-columns: 6em 1fr; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.specs div:last-child { border-bottom: 0; }
.specs div:nth-child(odd) { background: var(--bg-alt); }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; font-weight: 600; }
.mini-projects { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.thumbs { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-top: 8px; }
.thumbs a { display: block; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.thumbs img { width: 100%; height: 120px; object-fit: cover; object-position: top left; transition: transform .2s; }
.thumbs a:hover img { transform: scale(1.04); }

/* ---- 技能、證照 ---- */
.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.tag { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 14px; font-size: 15px; }
.tag--hl { background: var(--accent-soft); border-color: #bcd3fb; color: #0b4bb3; font-weight: 700; }
.certs { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.certs li { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; }
.certs span { color: var(--muted); font-size: 14px; }

/* ---- 獲獎 ---- */
.awards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 24px; }
.awards li { display: grid; grid-template-columns: 3.4em 1fr auto; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px dashed var(--line); }
.awards time { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.awards em { font-style: normal; font-size: 14px; padding: 2px 10px; border-radius: 999px; background: var(--bg-alt); color: #475569; white-space: nowrap; }
.awards .gold em { background: #fef3c7; color: var(--gold); font-weight: 700; }

/* ---- 聯絡 ---- */
.contact { background: var(--navy); color: #e2e8f0; }
.contact .section__title { color: #fff; }
.contact .section__lead { color: #a9b8ca; }
.contact__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.contact__item { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); border-radius: var(--radius); padding: 20px 22px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.contact__label { font-size: 13px; letter-spacing: .08em; color: #93a6bd; }
.contact__item a { color: #fff; font-size: 18px; font-weight: 700; word-break: break-all; }
.copy { font: inherit; font-size: 13px; background: transparent; color: #cfe0ff; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; padding: 2px 12px; cursor: pointer; }
.copy:hover { background: rgba(255,255,255,.1); }

/* ---- GitHub 按鈕、Skript 插件精選 ---- */
.icon { width: 1.1em; height: 1.1em; flex: none; }
.btn { display: inline-flex; align-items: center; gap: 8px; }
.btn--dark { background: #1f2328; border-color: #1f2328; color: #fff; }
.nav .nav__gh { display: inline-flex; align-items: center; gap: 6px; }
.links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0; }
.nowrap { white-space: nowrap; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; background: var(--bg-alt); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; }
.plugins { margin: 0 0 64px; }
.plugins__head h3 { font-size: 23px; color: var(--navy); margin-bottom: 6px; }
.plugins__head p { color: var(--muted); }
.plugins__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 20px; }
.plugin { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: inherit; text-decoration: none; transition: transform .15s, box-shadow .15s, border-color .15s; }
.plugin:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(15,42,68,.12); border-color: #bcd3fb; }
.plugin img { width: 100%; height: 180px; object-fit: contain; background: #18181d; }
.plugin h4 { font-size: 17px; color: var(--navy); margin: 14px 18px 6px; }
.plugin p { margin: 0 18px 18px; font-size: 15px; color: #334155; line-height: 1.7; }
.plugin--text { padding-top: 18px; }
.plugin--text h4 { margin-top: 8px; }
.plugin__badge { align-self: flex-start; margin: 0 18px; font-size: 12px; font-weight: 700; color: #0b4bb3; background: var(--accent-soft); border-radius: 999px; padding: 2px 10px; }

.footer { background: #0a1d30; color: #8a9bb0; font-size: 14px; padding: 22px 0; text-align: center; }
.footer p { margin: 0; }
.footer a { color: #b8c7d9; }

:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }

/* ---- 響應式 ---- */
@media (max-width: 900px) {
  .hero__inner, .grid-2, .project, .mini-projects { grid-template-columns: 1fr; }
  .hero__inner { padding: 48px 0 56px; gap: 36px; }
  .hero__photo { order: -1; width: min(240px, 70%); }
  .project--flip .project__media { order: 0; }
  .awards { grid-template-columns: 1fr; }
  .contact__grid { grid-template-columns: 1fr 1fr; }
  .plugins__grid { grid-template-columns: 1fr 1fr; }
  .section { padding: 60px 0; }
}
@media (max-width: 720px) {
  .nav-toggle { display: inline-block; }
  .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; background: #fff; flex-direction: column; align-items: stretch; padding: 8px 20px 16px; border-bottom: 1px solid var(--line); box-shadow: 0 10px 20px rgba(0,0,0,.06); }
  .nav.is-open { display: flex; }
  .nav a { padding: 10px 12px; }
  .timeline h3 span { display: block; margin-left: 0; }
}
@media (max-width: 560px) {
  .contact__grid, .plugins__grid { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .certs { grid-template-columns: 1fr; }
  .awards li { grid-template-columns: 3em 1fr; }
  .awards em { grid-column: 2; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
@media print {
  .topbar, .hero__actions, .copy, .skip { display: none !important; }
  .contact { background: #fff; color: var(--ink); }
  .contact .section__title, .contact__item a { color: var(--ink); }
  .section { padding: 24px 0; }
}
