/* ============================================================
   1. 設計變數
   ============================================================ */
:root {
  /* ★ 改這裡：想換網站配色，只改下面三個顏色 */
  --bg: #f3f5f9;          /* 背景：雲白 */
  --ink: #16202e;         /* 文字：深藍墨色 */
  --accent: #E47A80;      /* 強調色：Hover、目前所在頁面、按鈕 */
  --muted: #6b7686;
  --line: #d9dee8;
  --pad: clamp(18px, 3.2vw, 44px);
  --big: clamp(32px, 7vw, 112px);          /* 首頁名字大小 */
  --roles-size: clamp(13px, 1.5vw, 19px);  /* 職稱字級 */
  --roles-bottom: 36px;                    /* 職稱離畫面底部的距離 */
  --ease: cubic-bezier(.2, .7, .2, 1);
  /* ★ 字體：標題 = Fraunces（有手感的柔和襯線），內文 = Nunito（圓潤親切） */
  --font: "Nunito", "Helvetica Neue", Arial, "PingFang HK", "Noto Sans TC", sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", "PingFang HK", "Noto Serif TC", serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img, video { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* 換頁淡入淡出 */
@keyframes pageIn { from { opacity: 0; } }
main { animation: pageIn .6s var(--ease); }
body.leaving main { opacity: 0; transition: opacity .28s; }

/* ============================================================
   2. 名字、導覽（所有頁面共用）
   ============================================================ */
.brand { position: fixed; z-index: 50; left: var(--pad); top: 18px; font-family: var(--display); font-size: 24px; font-weight: 600; line-height: 1; letter-spacing: -0.01em; white-space: nowrap; color: #fff; mix-blend-mode: difference; transition: opacity .3s; }
/* 首頁：名字放大，貼在職稱正上方 */
body.home .brand { top: calc(100svh - var(--roles-bottom) - var(--roles-size) * 1.3 - var(--big) * 0.88); font-size: var(--big); letter-spacing: -0.02em; color: #fff; mix-blend-mode: normal; }

.brand.has-logo img { display: block; height: 30px; width: auto; }
body.home .brand.has-logo img { height: calc(var(--big) * 0.9); }

.nav { position: fixed; z-index: 50; top: 18px; right: var(--pad); display: flex; gap: clamp(14px, 2.4vw, 32px); font-size: 16px; font-weight: 600; color: #fff; mix-blend-mode: difference; }
body.home .nav { color: #fff; mix-blend-mode: normal; }
.nav a { position: relative; }
.nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease); }
.nav a:hover::after { transform: scaleX(1); }
.nav a[aria-current="page"]::after { transform: scaleX(1); height: 2px; }   /* 目前所在頁面：常駐底線 */

/* 手機全螢幕選單 */
.menu-btn { display: none; position: fixed; z-index: 60; top: 12px; right: var(--pad); padding: 6px 0; font-size: 17px; font-weight: 500; color: #fff; mix-blend-mode: difference; }
body.home .menu-btn { color: #fff; mix-blend-mode: normal; }
body.home.menu-open .menu-btn { color: var(--ink); }
.menu { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 80px var(--pad) 40px; background: var(--bg); opacity: 0; visibility: hidden; transition: opacity .35s, visibility .35s; }
.menu.open { opacity: 1; visibility: visible; }
.menu a { font-family: var(--display); font-size: clamp(52px, 17vw, 110px); font-weight: 500; letter-spacing: -0.02em; line-height: 1.05; opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease), transform .6s var(--ease), color .2s; }
.menu.open a { opacity: 1; transform: none; }
.menu.open a:nth-child(2) { transition-delay: .05s; } .menu.open a:nth-child(3) { transition-delay: .1s; } .menu.open a:nth-child(4) { transition-delay: .15s; }
.menu a[aria-current="page"] { color: var(--accent); }                /* 目前所在頁面：變色＋小圓點 */
.menu a[aria-current="page"]::after { content: ""; display: inline-block; width: .13em; height: .13em; margin-left: .16em; border-radius: 50%; background: var(--accent); vertical-align: .55em; }
.menu-foot { margin-top: 36px; color: var(--muted); font-size: 15px; }
body.menu-open { overflow: hidden; }
body.menu-open.home .brand { opacity: 0; }

/* ============================================================
   3. 首頁 Hero 幻燈片
   ============================================================ */
.hero { position: relative; height: 100svh; min-height: 520px; overflow: hidden; background: #fff; }
body.home { background: #fff; }
.hero::before, .hero::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.hero::before { background: linear-gradient(to bottom, rgba(10,16,30,.4), transparent 26%); }
.hero::after { background: linear-gradient(to top, rgba(10,16,30,.55), transparent 48%); }
.slides { position: absolute; inset: 0; overflow: hidden; background: #fff; }
/* 左半邊 = 上一張，右半邊 = 下一張（看不見，只有滑鼠游標會變） */
.zone { position: absolute; top: 0; bottom: 0; width: 50%; z-index: 3; background: none; -webkit-tap-highlight-color: transparent; }
.zone.prev { left: 0; cursor: default; }   /* 不顯示左右箭頭游標，點擊功能照常 */
.zone.next { right: 0; cursor: default; }
.slide { position: absolute; inset: 0; opacity: 0; transition: opacity 1.2s ease; }
.slide.on { opacity: 1; }
.slide img, .slide video, .slide .ph { width: 100%; height: 100%; object-fit: cover; }
@keyframes drift { from { transform: scale(1); } to { transform: scale(1.06); } }
.slide.on img, .slide.on .ph { animation: drift 8s linear forwards; }   /* 很慢的微放大 */
.hero-roles { position: absolute; z-index: 2; left: var(--pad); bottom: var(--roles-bottom); color: #fff; pointer-events: none; font-family: var(--display); font-style: italic; font-size: var(--roles-size); line-height: 1.3; white-space: nowrap; }
.slide-ui { position: absolute; z-index: 4; right: var(--pad); bottom: var(--roles-bottom); display: flex; flex-direction: column; align-items: flex-end; gap: 10px; color: #fff; font-size: 14px; }
.dots { display: flex; gap: 4px; }
.dots button { width: 34px; height: 20px; position: relative; }
.dots button::after { content: ""; position: absolute; left: 0; right: 0; top: 9px; height: 2px; background: rgba(255,255,255,.5); transition: background .3s; }
.dots button.on::after { background: #fff; }
.slide .ph { background: linear-gradient(135deg, hsl(var(--h) 45% 40%), hsl(calc(var(--h) + 40) 50% 58%)); }
.slide .hint { color: rgba(255,255,255,.8); }

/* ============================================================
   4. 內頁共用
   ============================================================ */
.section { padding: clamp(72px, 11vw, 160px) var(--pad) 0; }
.page > .section:first-child { padding-top: clamp(96px, 12vw, 150px); }
.section-title { font-family: var(--display); font-size: clamp(30px, 4.4vw, 64px); font-weight: 500; letter-spacing: -0.02em; line-height: 1.05; margin-bottom: clamp(24px, 3vw, 48px); }
.footer { padding: clamp(80px, 10vw, 140px) var(--pad) 32px; color: var(--muted); font-size: 14px; }


/* 作品卡片 */
.media { position: relative; overflow: hidden; background: #dfe5f0; border-radius: 4px; }
.media > img, .media > video, .media > .ph { width: 100%; height: 100%; object-fit: cover; object-position: var(--focus, 50% 50%); }
.media .pv { position: absolute; inset: 0; opacity: 0; transition: opacity .35s; }
.media .pv.ready { opacity: 1; }
.ph { background: linear-gradient(135deg, hsl(var(--h) 75% 78%), hsl(calc(var(--h) + 40) 80% 90%)); display: grid; place-items: center; text-align: center; }
.hint { padding: 12px; font-size: 13px; line-height: 1.35; color: rgba(22,32,46,.55); word-break: break-all; }
.media img, .media video, .media .ph { transition: transform .8s var(--ease); }
.card:hover .media > :first-child { transform: scale(1.035); }

.controls { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; margin-bottom: 28px; border-top: 1px solid var(--line); padding-top: 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.filters button { color: var(--muted); padding: 2px 0; border-bottom: 1px solid transparent; transition: color .2s; }
.filters button:hover { color: var(--ink); }
.filters button.active { color: var(--ink); border-bottom-color: var(--accent); }



/* Work Grid：3 欄。標示 spotlight 的重點作品會變大（跨 2 欄 × 2 列），排在最前面 */
.spot-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(14px, 2vw, 28px); margin-bottom: clamp(14px, 2vw, 28px); }
.spot-grid:empty { display: none; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(14px, 2vw, 28px); }
.grid.masonry { display: block; column-count: 3; column-gap: clamp(14px, 2vw, 28px); }
.grid.masonry .card { break-inside: avoid; margin-bottom: clamp(14px, 2vw, 28px); }
.grid.masonry .card .media { aspect-ratio: var(--ratio, 4 / 3); }
.card.spot .media { aspect-ratio: 16 / 10; }
/* 系列標籤：疊層圖示 + 數量（單張作品沒有） */
.series-tag { position: absolute; z-index: 2; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; background: rgba(22,32,46,.72); color: #fff; font-size: 13px; font-weight: 700; line-height: 1; backdrop-filter: blur(4px); }
/* 直式作品：fit: "contain" 完整顯示不裁切 */
.card.contain .media { background: #e6ebf3; }
.card.contain .media > img, .card.contain .media > video { object-fit: contain; }
.card { display: block; cursor: pointer; }
.card .media { aspect-ratio: 4 / 3; }
.card .meta { display: flex; justify-content: space-between; gap: 12px; padding-top: 10px; font-size: 14px; }
.card .meta strong { font-weight: 500; font-size: 14px; }   /* 作品名稱：低調一點 */
.card .meta span { color: var(--muted); }
.card.hide { display: none; }

.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* About */
.about-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(24px, 5vw, 80px); align-items: start; }
.about-body { max-width: 62ch; display: grid; gap: 18px; color: var(--muted); }
.about-lead { font-family: var(--display); font-weight: 400; color: var(--ink); font-size: clamp(22px, 2.6vw, 34px); line-height: 1.25; letter-spacing: -0.02em; }
.about-photo { display: grid; place-items: center; text-align: center; aspect-ratio: 4 / 5; border-radius: 4px; overflow: hidden; background: linear-gradient(135deg, #c9d6ff, #f1e6ff); }
.about-photo img { width: 100%; height: 100%; object-fit: cover; }

/* Contact */
.contact-mail { display: inline-block; font-family: var(--display); font-size: clamp(28px, 6vw, 88px); font-weight: 500; letter-spacing: -0.02em; line-height: 1; border-bottom: 2px solid var(--ink); transition: color .25s, border-color .25s; }
.contact-mail:hover { color: var(--accent); border-color: var(--accent); }
.contact-list { margin-top: clamp(28px, 4vw, 56px); max-width: 640px; border-bottom: 1px solid var(--line); }
.contact-list a { display: flex; justify-content: space-between; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); transition: color .2s, padding .3s var(--ease); }
.contact-list a span:first-child { color: var(--muted); }
.contact-list a:hover { color: var(--accent); padding-left: 8px; }


/* ============================================================
   作品頁（project.html）
   ============================================================ */
.project-inner { max-width: 1280px; margin: 0 auto; }
.back { display: inline-block; color: var(--muted); font-weight: 600; margin-bottom: clamp(20px, 3vw, 40px); transition: color .2s, transform .3s var(--ease); }
.back:hover { color: var(--accent); transform: translateX(-4px); }
.project-head { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(20px, 5vw, 80px); align-items: end; margin-bottom: clamp(36px, 6vw, 88px); }
.project-meta { color: var(--muted); margin-bottom: 10px; }
.project-title { font-family: var(--display); font-weight: 400; font-size: clamp(26px, 3.4vw, 46px); line-height: 1.1; letter-spacing: -0.015em; }
.project-desc { display: grid; gap: 12px; max-width: 56ch; }
.project-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; margin-top: 20px; font-size: 15px; }
.project-facts dt { color: var(--muted); }
.project-desc:empty, .project-facts:empty { display: none; }
.project-body { display: grid; gap: clamp(40px, 6vw, 96px); }
.pi { margin: 0; }
/* 每張圖用自己的原始比例顯示，不裁切；太高的直式圖最多佔 90% 螢幕高度 */
.pi img, .pi video { display: block; width: auto; max-width: 100%; max-height: 90vh; margin: 0 auto; border-radius: 4px; background: #e6ebf3; }
.pi img.zoomable { cursor: zoom-in; }
.pi iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 4px; }
.pi .ph { width: 100%; aspect-ratio: 16 / 10; border-radius: 4px; }
.pi figcaption { display: grid; gap: 8px; max-width: 62ch; margin: 16px auto 0; color: var(--muted); }
.back-bottom { margin: clamp(48px, 7vw, 100px) 0 0; }

/* 作品頁：往下捲動時，一次停在一張圖的正中間（scroll-snap） */
html.snap-project { scroll-snap-type: y mandatory; }
html.snap-project .project::before { content: ""; display: block; height: 1px; scroll-snap-align: start; scroll-margin-top: 400px; }   /* 頁面最上方 */
html.snap-project .page > .section.project { padding-top: 80px; }   /* 標題往上收，第一眼就能看到標題和第一張圖 */
html.snap-project .back { margin-bottom: 14px; }
html.snap-project .project-head { margin-bottom: 18px; }
html.snap-project .project-body { gap: 0; }
html.snap-project .pi img, html.snap-project .pi video { max-height: 82svh; }
html.snap-project .pi { scroll-snap-align: center; scroll-snap-stop: always; min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; }   /* 第二張起，每張圖佔滿一整個畫面 */
html.snap-project .pi:first-child { min-height: 0; justify-content: flex-start; scroll-snap-align: none; }   /* 第一張：和標題一起出現在第一屏 */
html.snap-project .pi:first-child img, html.snap-project .pi:first-child video { max-height: max(240px, calc(100svh - 260px)); }
/* 右側頁碼點點：極簡，目前這張是一條短線 */
.pager { position: fixed; z-index: 30; right: max(2px, calc(var(--pad) / 2 - 10px)); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; }
.pager button { position: relative; width: 20px; height: 20px; }
.pager button::after { content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 2px; background: var(--ink); opacity: .2; transition: opacity .3s, height .3s var(--ease), margin .3s var(--ease); }
.pager button.on::after { opacity: .8; height: 14px; margin-top: -7px; }
.pager button:hover::after { opacity: .6; }
html.snap-project .footer { scroll-snap-align: end; }                                                                                /* 頁面最下方 */

/* ============================================================
   5. Lightbox：← 作品 →
   ============================================================ */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(243,245,249,.97); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; padding: 10px var(--pad) 18px; opacity: 0; visibility: hidden; transition: opacity .35s, visibility .35s; }
.lightbox.open { opacity: 1; visibility: visible; }
.lb-bar { display: flex; justify-content: space-between; align-items: center; padding-bottom: 6px; }
.lb-bar button { padding: 10px 0; font-weight: 600; }
.lb-count { color: var(--muted); font-size: 14px; }
.lb-bar button:hover, .lb-arrow:hover { color: var(--accent); }
.lb-main { min-height: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: stretch; gap: clamp(2px, 2vw, 24px); }
.lb-arrow { align-self: center; font-size: 30px; line-height: 1; padding: 14px 10px; transition: color .2s; }
.lb-stage { min-height: 0; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; transform: scale(.97); transition: transform .5s var(--ease); }
.lightbox.open .lb-stage { transform: none; }
.lb-stage img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 4px; }
.lb-arrow.off { visibility: hidden; }
.lb-caption { padding-top: 14px; max-width: 70ch; max-height: 30vh; overflow-y: auto; }
.lb-caption h3 { font-family: var(--display); font-weight: 500; font-size: 24px; letter-spacing: -0.01em; }
.lb-caption p { color: var(--muted); }
body.locked { overflow: hidden; }

/* ============================================================
   6. 手機
   ============================================================ */
@media (max-width: 800px) {
  body { font-size: 16px; }
  .nav { display: none; }
  .menu-btn { display: block; }
  :root { --big: 8.2vw; --roles-bottom: 14svh; --roles-size: 12.5px; }
  .brand { font-size: 18px; }
  .brand.has-logo img { height: 26px; }
  .slide-ui { left: var(--pad); right: var(--pad); bottom: 5svh; flex-direction: row; align-items: center; justify-content: space-between; }
  .spot-grid { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }          /* 手機：作品一張一張往下排 */
  .grid.masonry { column-count: 1; }
  .card .media { aspect-ratio: var(--ratio, 4 / 3); }   /* 手機：直式作品用自己的比例 */
  .card.spot .media { aspect-ratio: 4 / 3; }
  .about-grid { grid-template-columns: 1fr; }
  .project-head { grid-template-columns: 1fr; align-items: start; }
  .about-photo { max-width: 420px; }
  .lb-arrow { font-size: 24px; padding: 10px 4px; }
  .lb-caption { max-height: 34vh; }
}
@media (max-width: 1000px) and (min-width: 801px) { .grid { grid-template-columns: repeat(2, 1fr); } .grid.masonry { column-count: 2; } }
@media (min-width: 801px) { .menu { display: none; } }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
