/* =========================================================
   作品集網站 — 設計系統（改視覺就改這個檔）
   取自 ~/Github/website/index.html 的視覺語言
   build.mjs 會把這個檔複製到 dist/styles.css
   ========================================================= */
:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --text: #1a1c1f;
  --text-soft: #5b6069;
  --line: #e7e9ec;
  --accent: #3b5bfd;
  --accent-soft: #eef1ff;
  --insight: #0b6b5b;               /* 洞察卡專屬綠（Notion toggle 攤開後）*/
  --insight-soft: #e8f3f0;
  --radius: 16px;
  --maxw: 1080px;
  --maxw-read: 760px;               /* 內頁閱讀寬度 */
  --font: "Inter", "Noto Sans TC", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- Nav ---------- */
header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.8);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { font-weight: 700; letter-spacing: -.02em; font-size: 18px; }
.logo span { color: var(--accent); }
.nav-links { display: flex; gap: 32px; }
.nav-links a { font-size: 15px; color: var(--text-soft); transition: color .2s; }
.nav-links a:hover { color: var(--text); }
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; font-size: 24px; }

/* ---------- Hero ---------- */
.hero { padding: 96px 0 72px; }
.hero .eyebrow {
  display: inline-block; font-size: 14px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); padding: 6px 14px; border-radius: 999px; margin-bottom: 24px;
}
.hero h1 {
  font-size: clamp(38px, 6vw, 64px); line-height: 1.1; letter-spacing: -.03em;
  font-weight: 700; max-width: 16ch; margin-bottom: 24px;
}
.hero .lead { font-size: 19px; color: var(--text-soft); max-width: 48ch; margin-bottom: 36px; }
.cta-row { display: flex; gap: 14px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 24px; border-radius: 999px; font-weight: 600; font-size: 15px;
  transition: transform .15s, background .2s, box-shadow .2s; cursor: pointer; border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(59,91,253,.25); }
.btn-ghost { border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--bg-soft); }

/* ---------- Section shell ---------- */
section { padding: 72px 0; }
.section-head { margin-bottom: 44px; }
.section-head .kicker { font-size: 14px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; }
.section-head h2 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -.02em; margin-top: 8px; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; align-items: start; }
.about-grid p { color: var(--text-soft); font-size: 17px; margin-bottom: 16px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.stat { background: var(--bg-soft); border-radius: var(--radius); padding: 24px; }
.stat .num { font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.stat .label { font-size: 14px; color: var(--text-soft); margin-top: 4px; }

/* ---------- Work grid (作品卡片) ---------- */
.work-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px; }
.card {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: transform .2s, box-shadow .2s; background: var(--bg); display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(20,22,26,.08); }
.card .thumb { aspect-ratio: 16 / 10; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 20px; letter-spacing: .02em; text-align: center; padding: 20px; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.g1 { background: linear-gradient(135deg,#6a8bff,#3b5bfd); }
.g2 { background: linear-gradient(135deg,#ff9a76,#ff5e8a); }
.g3 { background: linear-gradient(135deg,#5ad1c5,#2aa39a); }
.g4 { background: linear-gradient(135deg,#b58bff,#7a4bff); }
.g5 { background: linear-gradient(135deg,#ffc36b,#ff8a3d); }
.card .body { padding: 22px 24px 26px; }
.card .tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tag { font-size: 12px; font-weight: 600; color: var(--text-soft); background: var(--bg-soft); padding: 4px 10px; border-radius: 999px; }
.card h3 { font-size: 20px; letter-spacing: -.01em; margin-bottom: 8px; }
.card p { color: var(--text-soft); font-size: 15px; }

/* ---------- Certifications / Publications ---------- */
.pubs { display: flex; flex-direction: column; gap: 14px; }
.pub { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; }
.pub .pub-name { font-weight: 600; margin-bottom: 6px; }
.pub .pub-desc { color: var(--text-soft); font-size: 15px; }

/* ---------- Contact ---------- */
.contact { text-align: center; }
.contact h2 { font-size: clamp(30px, 5vw, 48px); letter-spacing: -.02em; margin-bottom: 16px; }
.contact p { color: var(--text-soft); font-size: 18px; max-width: 40ch; margin: 0 auto 32px; }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--line); padding: 32px 0; }
.foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; color: var(--text-soft); font-size: 14px; }
.foot .socials { display: flex; gap: 20px; }
.foot .socials a:hover { color: var(--accent); }

/* =========================================================
   作品內頁（case study）— 渲染 Notion 內文用
   ========================================================= */
.case-hero { padding: 56px 0 32px; border-bottom: 1px solid var(--line); }
.case-hero .back { font-size: 14px; color: var(--text-soft); margin-bottom: 20px; display: inline-block; }
.case-hero .back:hover { color: var(--accent); }
.case-hero .eyebrow { display: inline-block; font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 5px 12px; border-radius: 999px; margin-bottom: 18px; }
.case-hero h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.18; letter-spacing: -.02em; max-width: 22ch; }
.case-hero h1 .t-lead { display: block; font-size: .5em; font-weight: 600; color: var(--accent); letter-spacing: 0; line-height: 1.4; margin-bottom: 10px; }
.case-hero h1 .t-main { display: block; }
.case-hero .summary { margin-top: 20px; color: var(--text-soft); font-size: 17px; max-width: var(--maxw-read); }

.case-body { max-width: var(--maxw-read); margin: 0 auto; padding: 48px 24px 96px; }
.case-body > * + * { margin-top: 18px; }
/* 章節小標：Notion 裡的藍色 heading_3 是「這是章節標籤」的標記，視覺在這裡決定 */
.case-body .sec-kicker {
  display: inline-block; font-size: 13px; font-weight: 600; letter-spacing: .02em;
  color: var(--accent); background: var(--accent-soft);
  padding: 5px 13px; border-radius: 999px;
  margin-top: 56px; margin-bottom: 2px;
}
/* 小標後面緊跟的大標，不要再加大的上緣間距（小標已經把間距頂開了） */
.case-body .sec-kicker + h3 { margin-top: 10px; }
.case-body h2 { font-size: 26px; letter-spacing: -.01em; margin-top: 44px; }
.case-body h3 { font-size: 21px; margin-top: 36px; }
.case-body h4 { font-size: 18px; margin-top: 28px; }
/* 整段只有一個行內 code 的段落 = 洞察/章節標籤：上面拉開留白、與下方標題貼緊，綁成一組 */
.case-body p:has(> code:only-child) { margin-top: 52px; margin-bottom: 4px; }
.case-body p:has(> code:only-child) + h3 { margin-top: 6px; }
.case-body p { font-size: 17px; color: #2b2e33; }
.case-body ul, .case-body ol { padding-left: 22px; }
.case-body li { font-size: 17px; color: #2b2e33; margin: 6px 0; }
.case-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.case-body hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
.case-body strong { font-weight: 700; }
/* 內文關鍵字強調（Notion 行內 code）：不用 chip，改 accent 色底線 */
.case-body code {
  font-family: inherit; font-size: inherit; font-weight: 600;
  background: none; padding: 0; border-radius: 0; color: var(--text);
  border-bottom: 2px solid var(--accent);
  text-underline-offset: 3px;
}

.case-body figure { margin: 28px 0; }
.case-body figure img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); cursor: zoom-in; }
.case-body figcaption { font-size: 14px; color: var(--text-soft); text-align: center; margin-top: 10px; }

.case-body blockquote {
  margin-left: 28px;                 /* 引用原句往內縮排，與正文區隔 */
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  padding: 14px 20px; border-radius: var(--radius); font-size: 17px;
}
.case-body .callout {
  display: flex; gap: 12px; background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
}
.case-body .callout .cico { font-size: 20px; line-height: 1.4; }
/* callout 裡若堆了多張洞察卡，彼此要有間距 */
.case-body .callout > div > * + * { margin-top: 12px; }

/* 圖文雙欄：設計產出的卡若是「文字＋一張夠方/直的圖」→ 文一側、圖一側，左右交錯。
   太寬的合成圖不會走這裡（build.mjs 依圖片比例判定），維持滿版單欄。 */
.case-body .duo {
  display: grid; grid-template-columns: 1fr 1fr; gap: 32px;
  align-items: center; margin: 28px 0;
}
.case-body .duo.rev .duo-media { order: -1; }        /* 交錯：圖在左、文在右 */
.case-body .duo-text > * + * { margin-top: 12px; }
.case-body .duo-text > :first-child { margin-top: 0; } /* 欄內首個標題不頂出額外留白 */
.case-body .duo-media figure { margin: 0; }
.case-body .duo-media img { border-radius: 12px; }
@media (max-width: 640px) {
  .case-body .duo { grid-template-columns: 1fr; gap: 16px; } /* 手機收單欄 */
  .case-body .duo.rev .duo-media { order: 0; }               /* 圖回到文字上方 */
}

/* 洞察卡：一張「呈現洞察」的卡片——不是引用。
   左側色條＋單邊圓角是 blockquote 的語彙，會讓人讀成引用；這裡改成
   四角皆圓、細框、柔底的獨立面板，明確是一張卡。 */
.case-body .insight {
  background: var(--insight-soft);
  border: 1px solid color-mix(in srgb, var(--insight) 20%, transparent);
  border-radius: var(--radius); padding: 20px 22px;
}
.case-body .insight > * + * { margin-top: 12px; }
.case-body .insight-lead { font-size: 17px; color: var(--text); line-height: 1.7; }
.case-body .insight-lead strong { font-weight: 700; }
.case-body .insight figure { margin: 0; }        /* 卡內圖不要再撐大留白 */
.case-body .insight figure img { border-radius: 10px; }

/* 分層次：lead 是洞察主角（結論）；其後是 toggle 攤開的「使用者聲音」＝佐證。
   用卡內一條細分隔線把「結論／佐證」分成上下兩層，佐證縮小、淡色，
   行首 code 收成安靜小 chip——不再用左側色條，避免又讀成 quote。
   色彩綁 --insight 色票，日後換色會一起換。 */
.case-body .insight-lead + p {
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid color-mix(in srgb, var(--insight) 15%, transparent);
}
.case-body .insight-lead ~ p {
  font-size: 15px; color: var(--text-soft); line-height: 1.65;
}
.case-body .insight-lead ~ p + p { margin-top: 10px; }
.case-body .insight-lead ~ p code {
  font-size: 13px; font-weight: 700; color: var(--insight);
  background: color-mix(in srgb, var(--insight) 12%, transparent);
  padding: 1px 9px; border-radius: 999px; border-bottom: 0;
  margin-right: 7px;
}

/* 中性產出卡（配角）：非「洞察」章節的單一 toggle。刻意比綠色洞察卡輕，不搶主角。 */
.case-body .output { border-left: 3px solid var(--line); padding: 2px 0 2px 18px; }
.case-body .output > * + * { margin-top: 12px; }
.case-body .output-lead { font-size: 16px; font-weight: 700; color: var(--text-soft); line-height: 1.6; }
.case-body .output-lead strong { color: var(--text); }
.case-body .output figure { margin: 0; }

/* 流程型編號清單：放在 callout 裡的編號清單 = 一段流程 → 圓形序號標（跟走查同語言）。
   頂層的編號清單維持瀏覽器樸素樣式（普通列舉）。 */
.case-body .callout ol { list-style: none; padding-left: 0; counter-reset: flow; }
.case-body .callout ol li {
  position: relative; padding-left: 40px; margin: 0 0 12px; counter-increment: flow;
}
.case-body .callout ol li:last-child { margin-bottom: 0; }
.case-body .callout ol li::before {
  content: counter(flow); position: absolute; left: 0; top: 1px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* 走查 walkthrough：Notion 一組「有編號」的 toggle → 一條故事線（序號軸）。 */
.case-body .walk { margin: 10px 0; }
.case-body .walk .rail { position: relative; padding-left: 52px; }
.case-body .walk .rail::before {
  content: ""; position: absolute; left: 17px; top: 8px; bottom: 8px; width: 2px; background: var(--line);
}
.case-body .walk .beat { position: relative; }
.case-body .walk .beat + .beat { margin-top: 32px; }
.case-body .walk .beat-num {
  position: absolute; left: -52px; top: -2px; width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 5px var(--bg);
}
.case-body .walk .beat-why { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 10px; line-height: 1.6; }
.case-body .walk .beat figure { margin: 4px 0 0; max-width: 560px; }

/* 分頁 tabs：Notion 的一組 toggle → 分頁元件（參考 hsinchu-pass 的設計）。 */
.case-body .tabs { margin: 8px 0; }
.case-body .tablist { display: flex; gap: 8px; flex-wrap: wrap; border-bottom: 2px solid var(--line); }
.case-body .tab {
  appearance: none; background: none; border: none; cursor: pointer; font-family: inherit;
  padding: 12px 16px 11px; border-bottom: 2px solid transparent; margin-bottom: -2px;
  color: var(--text-soft); font-size: 16px; font-weight: 700;
  transition: color .15s, border-color .15s;
}
.case-body .tab:hover { color: var(--text); }
.case-body .tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.case-body .panel {
  display: none; background: var(--bg-soft); border: 1px solid var(--line); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius); padding: 28px 28px 26px;
}
.case-body .panel[data-active="true"] { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.case-body .panel-lead { font-size: 17px; color: var(--text); line-height: 1.7; margin-bottom: 14px; }
.case-body .panel-lead strong { font-weight: 700; }
.case-body .panel > * + * { margin-top: 14px; }
.case-body .panel figure { margin: 4px 0 0; }

/* lightbox：作品內文任何圖片點擊 → 彈窗看原圖 */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: none;
  align-items: center; justify-content: center; padding: 24px;
  background: rgba(15, 17, 20, .82); cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 100%; max-height: 100%; width: auto; border: none; border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, .45);
}

.case-body .cols { display: grid; grid-template-columns: repeat(var(--n,2), 1fr); gap: 20px; align-items: start; }
.case-body .cols .col > * + * { margin-top: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .nav-links { position: fixed; inset: 64px 0 auto 0; background: #fff; flex-direction: column; gap: 0; padding: 12px 24px 24px; border-bottom: 1px solid var(--line); transform: translateY(-120%); transition: transform .3s; }
  .nav-links.open { transform: translateY(0); }
  .nav-links a { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .nav-toggle { display: block; }
  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .work-grid { grid-template-columns: 1fr; }
  .case-body .cols { grid-template-columns: 1fr; }
}
