/* Global design system / 全域設計系統：
   - 若要調整整體色彩，修改下方 CSS 變數即可
   - To update theme colors, change the variables below
*/
:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --muted: #5a5a5a;
  --accent: #ff7a00;
  --accent-2: #6b8cff;
  --surface: #f5f7fa;
  --border: #e6e8eb;
}

/* Explicit theme state via data-theme / 以 data-theme 明確設定主題 */
:root[data-theme="dark"] {
  --bg: #0f1115;
  --text: #eaeef2;
  --muted: #b7c0cc;
  --accent: #ff8d3a;
  --accent-2: #8aa2ff;
  --surface: #151822;
  --border: #242a36;
}

/* System preference fallback / 系統偏好回退 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0f1115;
    --text: #eaeef2;
    --muted: #b7c0cc;
    --accent: #ff8d3a;
    --accent-2: #8aa2ff;
    --surface: #151822;
    --border: #242a36;
  }
}

html { scroll-behavior: smooth; }

/* Reset / 重置 */
* { padding: 0; margin: 0; }

header { width: 100%; }

body {
  /* 字體：如需更換，至 index.html 的 Google Fonts 調整 */
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Navigation / 導覽列 */
.nav {
  padding: 16px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  backdrop-filter: saturate(140%) blur(8px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}
.brand {
  font-size: 1.1rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text);
  letter-spacing: 0.5px;
}
.nav-links {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  list-style: none;
  display: flex;
  gap: 62px;
}
.nav-links a {
  font-size: 1rem;
  text-decoration: none;
  color: var(--muted);
  padding: 5px;
  border-radius: 8px;
  transition: color .2s ease, background .2s ease;
}
.nav-links a:hover {
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
}

/* Controls on nav / 導覽上的控制按鈕（語言/主題） */
.nav-ctrl { display: flex; align-items: center; gap: 8px; }
.ctrl-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.9rem;
  cursor: pointer;
}
.ctrl-btn:hover { background: color-mix(in srgb, var(--surface) 80%, var(--accent-2)); }
.ctrl-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* Hero / 首屏 */
.hero { padding: 100px 48px; max-width: 1200px; margin: 0 auto; }
.accent { font-size: 4rem; letter-spacing: -2px; font-weight: 600; line-height: 1.1; color: var(--text); }
.tagline { margin-top: 0.8rem; font-size: 1.2rem; font-weight: 400; line-height: 1.1; color: var(--muted); max-width: 720px; }
.hero-cta { display: flex; gap: 12px; margin-top: 24px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--border); text-decoration: none; font-weight: 500; }
.btn.primary { background: var(--text); color: var(--bg); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: var(--surface); color: var(--text); }
.btn.ghost:hover { background: color-mix(in srgb, var(--surface) 80%, var(--accent-2)); }

/* Divider & Footer / 分隔線與頁尾 */
hr { margin: 0px 48px; border: none; border-top: 1px solid var(--border); }
footer { padding: 1rem 0px; display: flex; align-items: center; justify-content: center; color: var(--muted); border-top: 1px solid var(--border); }

/* Projects layout / 作品區塊版型
   - 新增作品：維持 .wk 結構，於 .wk-img 加圖片，於 .wk-info 更新文字
   - Add new project: keep .wk structure, add images into .wk-img, update info
*/
.wk { color: #212121; max-width: 1200px; margin: 0 auto; padding: 0 48px; }
.wk h2 { margin: 1rem 0px 3rem 0px; font-size: 1.4rem; font-weight: 400; color: var(--muted); }

/* Image grid / 圖片格線：保證左右齊線 */
.wk-img { overflow: hidden; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; align-items: stretch; }
.wk-img img { width: 100%; height: clamp(240px, 25vw, 280px); background-color: #f5f5f5; object-fit: cover; object-position: center; border-radius: 10px; transition: transform .25s ease, box-shadow .25s ease; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.wk-img img:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,.12); }

/* Info row / 資訊列：與圖片同寬且高對比 */
.wk-info { width: 100%; max-width: none; margin: 1rem 0 6rem; padding: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 2.5rem; }
.wk-intro { display: flex; gap: 2rem; flex: 1; align-items: flex-start; }
.wk-intro p:first-child { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; background: var(--surface); padding: 4px 8px; border-radius: 6px; color: var(--accent); font-weight: 600; }
.wk-name { font-weight: 600; font-size: 1.1rem; color: var(--text); }
.wk-type { color: var(--text); font-weight: 500; opacity: 0.9; }
.wk-description { width: clamp(320px, 42%, 520px); flex-shrink: 0; color: var(--text); line-height: 1.6; }

/* About & Articles / 關於與文章：新增內容時保持 .about-inner 以維持寬度 */
.about, .articles { padding: 60px 48px; }
.about-inner { max-width: 960px; margin: 0 auto; }
.about h2, .articles h2 { font-size: 1.4rem; font-weight: 600; color: var(--text); margin-bottom: 1rem; }
.about p, .articles p { color: var(--muted); }

/* Responsive / 響應式：斷點調整
   - 若要新增斷點，按優先 mobile-first 原則
   - Add breakpoints following mobile-first principle
*/
@media (max-width: 1200px) { .wk-description { width: 360px; } }
@media (max-width: 1024px) { .accent { font-size: 3rem; letter-spacing: -1px; } }
@media (max-width: 900px) { .wk-description { width: clamp(300px, 50%, 480px); } }
@media (max-width: 768px) {
  .nav { padding: 12px 20px; }
  .nav-links { gap: 24px; }
  .hero { padding: 64px 20px; }
  .wk { padding: 0 20px; }
  .wk-img { justify-content: center; }
}
@media (max-width: 700px) {
  .wk-info { flex-direction: column; gap: 1.25rem; }
  .wk-description { width: 100%; }
}
@media (max-width: 560px) {
  .accent { font-size: 2.2rem; }
  .tagline { font-size: 1rem; }
  .nav-links { position: static; transform: none; }
}

/* Accessibility / 可存取性：降低動態 */
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
