/* ===== 顏色與字體 =====
   內文字體：Neuzeit S Book（原網站上傳到 Wix 的字體檔，放在 fonts/）。
   標題字體：原網站用的是 Klim 的「Test Domaine Display」，這是試用版字體，
   授權只允許測試、不能用在正式網站，所以這裡改用外觀最接近的免費字體 Newsreader。
   如果你購買了 Domaine Display 的網頁授權，把 woff2 檔命名為 DomaineDisplay-Regular.woff2
   放進 fonts/，再取消下面第二個 @font-face 的註解即可。 */
@font-face { font-family: "Neuzeit S"; src: url("../fonts/NeuzeitS-Book.woff2") format("woff2"); font-weight: 400; font-display: swap; }
/*
@font-face { font-family: "Domaine Display"; src: url("../fonts/DomaineDisplay-Regular.woff2") format("woff2"); font-display: swap; }
*/
:root {
  --ink: #2f2e2e;
  --black: #000;
  --muted: #999;
  --line: #2f2e2e;
  --bg: #fff;
  --serif: "Domaine Display", "Newsreader", "Songti TC", Georgia, serif;
  --sans: "Neuzeit S", "Albert Sans", "PingFang TC", "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.4; overflow-x: hidden;
  /* 和原網站相同的文字平滑設定（Mac 上字會比較細） */
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
/* 標題字體的粗細：Newsreader 450 的筆畫粗細最接近原網站的 Domaine Display */
.project-info h1, .about-text h1, .mm-panel, .face-label { font-weight: 450; }
.project-info h1 small { font-weight: 400; }
img { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--black); outline-offset: 3px; }

/* 1440px 為設計寬度：--u 等於設計稿上的 1%，讓整頁等比例縮放
   --edge 是螢幕比 1440px 寬時，兩側多出的空白 */
/* 原網站的電腦版是固定尺寸，視窗變窄時不會縮小（右側超出的部分被裁掉），
   所以寬度 1100px 以上都用 1440px 設計稿的原始尺寸，只有更窄時才等比縮小 */
/* --logo-bottom：名字標誌的下緣再往下留 12px，字卡與 About 文字不會超過這條線 */
:root { --logo-bottom: calc(22.14 * var(--u) + 12px); --u: min(1.3091vw, 14.4px); --edge: max(0px, (100vw - 1440px) / 2); --cedge: calc((100vw - 1440px) / 2); }
.frame { position: relative; max-width: 1440px; margin: 0 auto; }

/* ===== 頁首 ===== */
/* 圖層順序（同原網站）：作品圖片在最底層捲動，
   左側文字 50、Next Project 51、名字標誌 53、選單 55、版權 57 固定不動 */
.site-header a { pointer-events: auto; }
.logo { position: fixed; z-index: 53; left: calc(4.51 * var(--u)); top: calc(1.39 * var(--u)); width: calc(39.7 * var(--u)); display: block; pointer-events: none; }
.logo img { pointer-events: auto; }
.nav { position: fixed; z-index: 55; left: calc(var(--cedge) + 42.15 * var(--u)); top: calc(8.3 * var(--u)); display: flex; font-size: calc(2.5 * var(--u)); font-weight: 400; line-height: calc(3.47 * var(--u)); white-space: nowrap; }
/* 原網站選單每一項的固定寬度（Package Design 312px、Graphic Design 303px、About 144px），文字距左 5px */
.nav a { display: block; padding-left: calc(.35 * var(--u)); }
.nav a:nth-child(1) { width: calc(21.67 * var(--u)); }
.nav a:nth-child(2) { width: calc(21.04 * var(--u)); }
.nav a:nth-child(3) { width: calc(10 * var(--u)); }
.nav a { text-decoration: none; color: var(--black); white-space: nowrap; transition: color .2s; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--muted); }

.copyright { font-size: 13px; color: #666; margin: 0; }
.site-footer { position: fixed; left: calc(5.2 * var(--u)); bottom: 4px; z-index: 57; }

/* ===== 展開圖首頁 ===== */
/* 展開圖：和原網站一樣是固定尺寸（以 1440 寬設計），視窗較窄時往左移、右側超出的部分裁掉 */
.dieline { position: relative; width: calc(100 * var(--u)); margin-left: min(0px, max(var(--cedge), -170px)); }
.dieline > * { position: absolute; }
.dieline-bg { max-width: none; pointer-events: none; }
.face { z-index: 3; }
.face-label { z-index: 2; display: flex; align-items: center; justify-content: center; text-align: center;
  font-family: var(--serif); font-size: calc(2.083 * var(--u)); line-height: 1.2; color: #000;
  pointer-events: none; transition: color .4s ease-in-out; }
.face-preview { z-index: 4; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .4s ease-in-out, visibility 0s .4s; }
.face-preview img { width: 100%; height: 100%; object-fit: cover; }
.face-preview.is-on { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .4s ease-in-out; }
/* 原網站：平常是黑色，滑到作品上時文字變成灰色、旁邊出現作品圖 */
.face-label.is-on { color: var(--muted); }
.tile-grid { display: none; }

/* ===== 作品頁 ===== */
/* 電腦版作品頁：右側作品區照原網站從 x=440、寬 1070（以 1440px 寬為準）排列 */
.project { display: block; padding: 0 0 calc(6 * var(--u)); }
/* 左欄文字固定在畫面中，右欄圖片捲動（和原網站一樣） */
/* 左側基本資料：和原網站一樣是一張白色字卡，固定在畫面左下角（距離底部 20px），
   捲動時不會移動，作品圖片從字卡下方經過 */
.project-info { position: fixed; z-index: 50; bottom: 20px; left: calc(5.2 * var(--u)); width: calc(34.58 * var(--u));
  height: auto; padding: calc(var(--cpt, 1.875) * var(--u)) 0 calc(4 * var(--u));
  /* 字卡最高只到「Chao-Yi Wang」標誌下方；放不下時字卡內可以單獨捲動 */
  max-height: calc(100vh - 20px - var(--logo-bottom));
  background: #fff; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #c8c8c8 transparent;
  display: flex; flex-direction: column; justify-content: flex-start; }
@media (min-width: 821px) {
  .project-info[style*="--ch"] { height: min(calc(var(--ch) * var(--u)), calc(100vh - 20px - var(--logo-bottom)));
    /* 字卡被縮短時，先縮掉標題上方的留白（例如 Gua Sha），盡量不必捲動 */
    padding-top: max(calc(1.875 * var(--u)), calc(var(--cpt, 1.875) * var(--u) - max(0px, calc(var(--ch) * var(--u) - (100vh - 20px - var(--logo-bottom))))));
    padding-bottom: 16px; }
}
.project-info > * { flex-shrink: 0; }
.project-info::-webkit-scrollbar { width: 6px; }
.project-info::-webkit-scrollbar-thumb { background: #c8c8c8; border-radius: 3px; }
.project-info::-webkit-scrollbar-track { background: transparent; }
/* 作品區跟著置中的版面移動（視窗比 1440 窄時往左移，和原網站一樣）；名字標誌和字卡則固定靠左 */
.project-media { margin-left: calc(30.56 * var(--u) + min(0px, max(var(--cedge), -170px))); width: calc(74.31 * var(--u)); }
/* 標題區塊高度和文字位置照原網站（區塊高 101px，標題文字距上 33px），下面的說明和基本資料才會在一樣的位置 */
.project-info h1 { font-family: var(--serif); font-weight: 450; font-size: 40px; letter-spacing: .05em; line-height: 52px; height: 101px; padding-top: 33px; margin: 0; box-sizing: border-box; color: var(--ink); white-space: nowrap; }
.project-info h1 small { font-family: var(--sans); font-size: 16px; letter-spacing: normal; font-weight: 400; }
.project-info p { margin: 0 0 .6em; }
.project-info .desc { max-width: calc(var(--dw, 33) * var(--u)); }
@media (min-width: 821px) {
  .project-info .desc[style*="--dh"] { margin-top: calc(var(--dmt) * var(--u)); height: calc(var(--dh) * var(--u)); }
  .project-info .meta[style*="--mg"] { margin-top: calc(var(--mg) * var(--u)); }
}
.project-info p a { text-decoration: underline; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: nowrap; gap: 1.2rem 0; margin: 21px 0 0; font-size: 14px; }
.meta > div:last-child { flex: none; white-space: nowrap; }
.meta > div { width: calc(var(--cw, 9) * var(--u)); padding-right: 1rem; }
.meta dt { color: var(--muted); line-height: 30px; margin-bottom: 6px; }
.meta dd { margin: 0; line-height: 22px; }

.project-media { display: flex; flex-direction: column; min-width: 0; padding-bottom: 110px; }
.project .project-media > * { margin-top: calc(var(--dt, 1.2) * var(--u)); position: relative; z-index: var(--dz, auto); }
/* Next Project：和原網站一樣固定在視窗右下角（距右 80px、距下 40px），永遠在作品圖上層 */
.project .project-media > .next { margin: 0; position: fixed; z-index: 51; left: auto; right: 80px;
  width: calc(9.86 * var(--u)); height: calc(2.78 * var(--u)); padding: 0; display: flex; align-items: center; justify-content: center; }

/* 輪播框的比例照原網站，圖片完整顯示在框內 */
.project-media > .slideshow { aspect-ratio: var(--dar, auto); overflow: hidden; }

.shot { margin: 0; }
.shot img { width: 100%; height: auto; }
.caption { display: flex; justify-content: space-between; margin: 0; font-size: 15px; }
.caption span + span { font-style: italic; }
.next { font-weight: 700; position: fixed; z-index: 51; right: calc(var(--edge) + 5.56 * var(--u)); bottom: 40px; padding: .55rem 1.1rem; background: #fff; border: 1px solid var(--black); color: var(--black); text-decoration: none; font-size: 15px; transition: background .2s, color .2s; }
.next:hover { background: var(--black); color: #fff; }

/* 輪播 */
.slideshow { position: relative; }
/* 輪播：和原網站一樣自動播放、左右滑動換圖，圖片鋪滿框（多出的部分裁掉） */
.slides { list-style: none; margin: 0; padding: 0; position: relative; height: 100%; overflow: hidden; }
.slide { position: absolute; inset: 0; visibility: hidden; will-change: transform; }
.slide.is-active, .slide.is-moving { visibility: visible; }
/* 電腦版：每一張都有 1px 深灰色框線（原網站設定），滑動時兩張之間會看到一條分隔線 */
.slide { box-sizing: border-box; border: 1px solid rgb(47, 46, 46); background: #fff; }
.slide img { display: block; width: 100%; height: 100% !important; aspect-ratio: auto !important; object-fit: cover; cursor: zoom-in; }
.slideshow button { position: absolute; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--ink); font-size: 54px; line-height: 1; padding: .5rem 1rem; cursor: pointer; text-shadow: 0 0 8px #fff, 0 0 2px #fff; }
.ss-prev { left: 0; } .ss-next { right: 0; }
.ss-count { position: absolute; right: 1rem; bottom: .6rem; margin: 0; color: var(--ink); font-size: 14px; text-shadow: 0 0 6px #fff; }

/* 影片 */
.shot-video { position: relative; }
.shot-video video { display: block; width: 100%; height: auto; background: #f2f2f0; }
.sound { position: absolute; right: 8px; bottom: 8px; width: 40px; height: 36px; border: 0; cursor: pointer;
  background: center / 22px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='white'/%3E%3Cpath d='M17 9l4 6M21 9l-4 6'/%3E%3C/svg%3E");
  filter: drop-shadow(0 0 3px rgba(0,0,0,.5)); }
.sound[aria-pressed="true"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='white'/%3E%3Cpath d='M16.5 8.5a5 5 0 0 1 0 7M19 6a8.5 8.5 0 0 1 0 12'/%3E%3C/svg%3E"); }
/* 影片檔還沒放進來時：有封面的顯示封面，沒有封面的顯示提示 */
.video-missing .sound { display: none; }
.video-missing video:not([poster]) { min-height: 200px; }
.video-missing:not(:has(video[poster]))::after { content: "影片待補：" attr(data-missing); }
.video-missing:not(:has(video[poster])) { display: grid; }
.video-missing:not(:has(video[poster])) video { visibility: hidden; grid-area: 1 / 1; }
.video-missing:not(:has(video[poster]))::after { grid-area: 1 / 1; display: flex; align-items: center; justify-content: center; background: #eeeeec; color: #777; font: 14px/1.4 var(--sans); }

/* 尚未補上的圖片 */
img.is-missing { position: relative; min-height: 220px; width: 100%; height: auto; background: #eee; color: transparent; }
img.is-missing::after { content: "圖片待補：" attr(data-missing); position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 1rem; background: #eeeeec; color: #777; font: 14px/1.4 var(--sans); text-align: center; }

/* 放大檢視 */
.lightbox { border: 0; padding: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; background: rgba(255,255,255,.97); }
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 88vw; max-height: 90vh; width: auto; height: auto; }
.lightbox button { position: absolute; background: none; border: 0; font-size: 46px; line-height: 1; padding: 1rem; cursor: pointer; color: var(--ink); }
.lb-close { top: .5rem; right: 1rem; } .lb-prev { left: .5rem; top: 50%; transform: translateY(-50%); } .lb-next { right: .5rem; top: 50%; transform: translateY(-50%); }

/* ===== About ===== */
/* About（照原網站）：文字固定在左下角（底部距離 98px），照片固定在右側、垂直置中再往下 150px */
.about { min-height: 100vh; }
.about-text { position: fixed; z-index: 50; left: calc(5.28 * var(--u)); top: max(calc(100vh - 413px), var(--logo-bottom)); width: calc(35 * var(--u));
  max-height: calc(100vh - 20px - max(calc(100vh - 413px), var(--logo-bottom))); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #c8c8c8 transparent; background: #fff; }
.about-text h1 { font-family: var(--serif); font-weight: 450; font-size: 40px; letter-spacing: .05em; margin: 0; line-height: 58px; }
.about-text p { margin: 0; }
.about-image { position: fixed; z-index: 49; right: 84px; top: calc(50vh - 361px + 150px); width: calc(62.64 * var(--u)); margin: 0; }
.about-image img { width: 100%; height: auto; aspect-ratio: 902 / 722 !important; object-fit: cover; }

/* ===== 手機版（照原網站的手機版排版） =====
   原網站手機版以 320px 寬設計、再等比放大到手機螢幕，
   所以這裡用 --m（設計稿上的 1px）當單位；平板最多放大到 520px 寬。 */
.menu-toggle, .mobile-menu, .m-only { display: none; }
@media (min-width: 821px) and (max-width: 1099px) { .nav { left: auto; right: calc(1 * var(--u)); } }
@media (max-width: 820px) {
  :root { --m: min(calc(100vw / 320), 1.625px); }
  body { font-size: calc(16 * var(--m)); }
  .frame { max-width: calc(320 * var(--m)); }

  /* 頁首：名字標誌跟著頁面捲動，選單按鈕固定在右上角 */
  .site-header { position: relative; height: calc(140 * var(--m)); }
  .logo { position: absolute; left: calc(20 * var(--m)); top: calc(20 * var(--m)); width: calc(204 * var(--m)); }
  .nav { display: none; }
  /* 選單按鈕：照原網站的三條線（上短、中長、下短），點開時會先微微往反方向彈一下再轉成叉叉 */
  .menu-toggle { display: flex; align-items: center; justify-content: center; position: fixed; z-index: 80;
    top: calc(10 * var(--m)); right: max(calc(10 * var(--m)), calc((100vw - 320 * var(--m)) / 2 + 10 * var(--m)));
    width: calc(50 * var(--m)); height: calc(50 * var(--m)); padding: 0; border: 0; background: transparent; cursor: pointer;
    pointer-events: auto; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
  .mt-box { display: flex; flex-direction: column; justify-content: space-between; width: calc(26 * var(--m)); height: calc(21 * var(--m)); transition: transform .33s ease-out; }
  .mt-box span { display: block; width: 100%; height: calc(3 * var(--m)); border-radius: calc(1.5 * var(--m)); background: #000; }
  .mt-box .mt-l1 { width: 50%; transform-origin: 100%; transition: transform .33s cubic-bezier(.54,-.81,.57,.57); }
  .mt-box .mt-l3 { width: 50%; align-self: flex-end; transform-origin: 0; transition: transform .33s cubic-bezier(.54,-.81,.57,.57); }
  .menu-open .mt-box { transform: rotate(-45deg); }
  .menu-open .mt-box .mt-l1 { transform: rotate(-90deg) translateX(calc(4 * var(--m))); }
  .menu-open .mt-box .mt-l3 { transform: rotate(-90deg) translateX(calc(-4 * var(--m))); }

  /* 展開的選單：左側半透明灰色遮罩，右側白色選單區塊 */
  .mobile-menu { display: block; position: fixed; inset: 0; z-index: 70; visibility: hidden; transition: visibility 0s .4s; }
  .menu-open .mobile-menu { visibility: visible; transition: none; }
  .mm-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); opacity: 0; transition: opacity .4s ease; }
  .menu-open .mm-overlay { opacity: 1; }
  .mm-panel { position: absolute; top: 0; bottom: 0; right: max(0px, calc((100vw - 320 * var(--m)) / 2)); width: calc(260 * var(--m)); background: #fff;
    display: flex; flex-direction: column; gap: calc(22 * var(--m)); padding: calc(100 * var(--m)) calc(20 * var(--m)) 0 calc(30 * var(--m));
    font-family: var(--serif); font-size: calc(16 * var(--m)); line-height: 1.4;
    transform: translateX(100%); transition: transform .4s cubic-bezier(.22,1,.36,1); }
  .menu-open .mm-panel { transform: none; }
  .mm-panel a { color: #2f2e2e; text-decoration: none; }
  .lang-switch { display: none; }
  .mm-panel .mm-lang { display: flex; flex-wrap: wrap; gap: calc(6 * var(--m)) calc(14 * var(--m)); margin-top: calc(24 * var(--m)); padding-top: calc(16 * var(--m)); border-top: 1px solid #ddd;
    font-family: var(--sans); font-size: calc(13 * var(--m)); }
  .mm-panel .mm-lang button { background: none; border: 0; padding: calc(4 * var(--m)) 0; font: inherit; color: #2f2e2e; cursor: pointer; }
  .menu-open { overflow: hidden; }

  /* 首頁與 Graphic Design：作品封面一張一張往下排 */
  .dieline { display: none; }
  .tile-grid { display: grid; gap: calc(10 * var(--m)); padding: calc(var(--mtop, 10) * var(--m)) calc(20 * var(--m)) 0; }
  .tile img { width: 100%; aspect-ratio: 1; object-fit: cover; }

  /* 作品頁：照原網站手機版逐頁的位置排列（--mo 順序、--mt 上方間距、--mx 左側位移、--mw/--mh 寬高）
     有負的上方間距時會像原網站一樣部分重疊 */
  .project { display: flex; flex-direction: column; padding: 0 calc(20 * var(--m)); }
  .project-media { display: contents; }
  .project > *, .project-media > * { order: var(--mo, 50); }
  .project-info { position: static; width: auto; height: auto; max-height: none; overflow: visible; display: block; background: none;
    margin-top: calc(var(--mt, 10) * var(--m)); padding: calc(10 * var(--m)); }
  .project-info h1 { font-size: calc(var(--mtitle, 30) * var(--m)); line-height: 1.6; margin: 0; letter-spacing: .05em; height: auto; padding: 0; white-space: normal; }
  .project-info h1 small { font-size: calc(var(--msub, 16) * var(--m)); letter-spacing: .05em; display: inline-block; white-space: nowrap; }
  .project .shot-border { outline: 1px solid var(--ink); outline-offset: -1px; }
  .project-info .desc { font-size: calc(var(--mdesc, 12) * var(--m)); line-height: 1.4; }
  .project-info p { max-width: none; margin: 0; }
  .meta { display: block; margin: calc(10 * var(--m)) 0 0; font-size: calc(14 * var(--m)); }
  .meta > div { margin: 0; width: auto; padding: 0; }
  .meta dt { color: #a0a09f; line-height: calc(34 * var(--m)); margin: 0 0 calc(10 * var(--m)); }
  .meta dd { line-height: 1.6; margin: 0 0 calc(10 * var(--m)); }
  .project .shot { z-index: var(--mz, auto); }
  .project .shot, .project .slideshow { width: calc(var(--mw, 280) * var(--m)) !important; margin: calc(var(--mt, 10) * var(--m)) 0 0 calc(var(--mx, 0) * var(--m)) !important; position: relative; }
  .project .shot img, .project .shot video { width: 100%; height: auto; aspect-ratio: var(--mw) / var(--mh) !important; object-fit: cover; }
  .project .shot:not([style*="--mw"]) img, .project .shot:not([style*="--mw"]) video { aspect-ratio: auto !important; }
  .m-hide { display: none !important; }
  .project .caption { display: block; width: calc(280 * var(--m)) !important; font-size: calc(16 * var(--m)); line-height: calc(22 * var(--m)); margin: calc(var(--mt, 16) * var(--m)) 0 0 !important; }
  .project-info .desc { max-width: none; }
  .project .caption { text-align: center; }
  .project .caption span { display: block; }
  .project .caption span + span { font-style: italic; }
  .project-info .m-only { display: block; margin-bottom: calc(10 * var(--m)); }
  /* 輪播：280×200 的框，有細框線與左右箭頭 */
  .project .slideshow { height: calc(var(--mh, 200) * var(--m)); border: 1px solid var(--ink); background: #fff; overflow: hidden; }
  /* 原網站手機版的輪播是「填滿」：圖片鋪滿框，多出來的部分裁掉 */
  .project .slideshow.ss-plain { border: 0; }
  .slide { border: 0; }
  /* 細線箭頭 */
  .slideshow button { width: calc(30 * var(--m)); height: calc(60 * var(--m)); padding: 0; font-size: 0; color: transparent; text-shadow: none; }
  .slideshow button::before { content: ""; position: absolute; top: 50%; left: 50%; width: calc(14 * var(--m)); height: calc(14 * var(--m));
    border: solid #bbb; border-width: 0 0 1.5px 1.5px; transform: translate(-30%, -50%) rotate(45deg); }
  .slideshow .ss-next::before { transform: translate(-70%, -50%) rotate(-135deg); }
  .ss-count { display: none; }
  .next, .project .project-media > .next { display: none; }

  /* About：手機版只有文字 */
  .about { display: block; min-height: 0; padding: calc(20 * var(--m)) calc(20 * var(--m)) 0; }
  .about-text { padding: 0; position: static; width: auto; max-height: none; overflow: visible; background: none; }
  .about-text h1 { line-height: 1.4; }
  .about-text h1 { font-size: calc(30 * var(--m)); margin: 0 0 calc(4 * var(--m)); }
  .about-text p { font-size: calc(14 * var(--m)); line-height: 1.6; }
  .about-image { display: none; }

  .site-footer { position: static; padding: calc(25 * var(--m)) calc(21 * var(--m)) calc(20 * var(--m)); }
  .site-footer .copyright { font-size: calc(7 * var(--m)); color: #636363; }

  /* 手機版：文字從下方浮入（原網站手機版設定）；About 的文字不播動畫 */
  html.anim body [data-anim="right"].in { animation-name: float-in-bottom; }
  html.anim body .about [data-anim="right"]:not(.in) { opacity: 1; }
  html.anim body .about [data-anim="right"].in { animation: none; }
  html.intro-logo body .logo img, html.intro body .logo img, html.intro body .menu-toggle .mt-box { animation: float-in-bottom 1.2s cubic-bezier(.445,.05,.55,.95) backwards; }
}

/* ===== 語言切換 ===== */
html:lang(zh-Hant) { --sans: "Neuzeit S", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif; }
html:lang(ja) { --sans: "Neuzeit S", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif; }
html:lang(ko) { --sans: "Neuzeit S", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif; }
html:lang(zh-Hant) .desc, html:lang(ja) .desc, html:lang(ko) .desc { line-height: 1.65; }
html:lang(ko) .desc, html:lang(ko) .meta { word-break: keep-all; }
/* 翻譯後文字長短不同：字卡與說明改成依內容調整高度（字卡仍貼齊視窗下方） */
html:not([lang="en"]) .project-info .desc[style*="--dh"] { height: auto; }
html:not([lang="en"]) .project-info h1 { white-space: normal; height: auto; min-height: 101px; padding-bottom: 8px; }
@media (min-width: 821px) { html:not([lang="en"]) .project-info[style*="--ch"] { height: auto; min-height: min(calc(var(--ch) * var(--u)), calc(100vh - 20px - var(--logo-bottom))); } }

.lang-switch { position: fixed; z-index: 60; top: 18px; right: 24px; font-size: 14px; }
.lang-btn { display: flex; align-items: center; gap: 6px; background: none; border: 0; padding: 6px 2px; font: inherit; color: var(--ink); cursor: pointer; }
.lang-btn::after { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); transition: transform .2s; }
.lang-switch.open .lang-btn::after { transform: translateY(1px) rotate(-135deg); }
.lang-list { position: absolute; right: 0; top: 100%; margin: 4px 0 0; padding: 6px 0; list-style: none; background: #fff; border: 1px solid var(--ink); min-width: 120px;
  opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .2s, transform .2s, visibility 0s .2s; }
.lang-switch.open .lang-list { opacity: 1; visibility: visible; transform: none; transition: opacity .2s, transform .2s; }
.lang-list button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 7px 14px; font: inherit; color: var(--ink); cursor: pointer; white-space: nowrap; }
.lang-list button:hover, .lang-list button:focus-visible { background: #f2f2f0; }
.lang-list button[aria-current="true"], .mm-lang button[aria-current="true"] { color: var(--muted); }
.mm-lang { display: none; }

/* ===== 動畫（同原網站設定） ===== */
/* 文字與圖片浮出：FloatIn，1.2 秒；進入畫面時才播放 */
@keyframes float-in-right { from { opacity: 0; translate: 60px 0; } to { opacity: 1; translate: 0 0; } }
@keyframes float-in-bottom { from { opacity: 0; translate: 0 60px; } to { opacity: 1; translate: 0 0; } }
html.anim [data-anim]:not(.in) { opacity: 0; }
html.anim [data-anim="right"].in { animation: float-in-right 1.2s cubic-bezier(.39,.575,.565,1) backwards; }
html.anim [data-anim="bottom"].in { animation: float-in-bottom 1.2s cubic-bezier(.39,.575,.565,1) backwards; }
/* 名字標誌與選單：第一次進站時從右側浮入 */
html.intro .logo img, html.intro .nav { animation: float-in-right 1.2s cubic-bezier(.39,.575,.565,1) backwards; }
/* 首頁：名字標誌每次進來都從右側浮入（不參與換頁的淡入淡出，動畫才看得完整） */
html.intro-logo .logo img { animation: float-in-right 1.2s cubic-bezier(.39,.575,.565,1) backwards; }
html.intro-logo .logo { view-transition-name: none; }

/* 換頁效果：舊頁淡出 0.35 秒，新頁再淡入 0.35 秒（OutIn） */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: .35s cubic-bezier(.22,1,.36,1) both page-out; }
::view-transition-new(root) { animation: .35s cubic-bezier(.64,0,.78,0) .35s both page-in; }
.logo { view-transition-name: logo; } .nav { view-transition-name: nav; } .site-footer { view-transition-name: footer; }
@keyframes page-out { to { opacity: 0; } }
@keyframes page-in { from { opacity: 0; } }
/* 不支援換頁動畫的瀏覽器（例如 Firefox）改用 JavaScript 淡入淡出 */
html.no-vt body { animation: page-in .35s cubic-bezier(.64,0,.78,0) both; }
html.no-vt body.leaving { opacity: 0; transition: opacity .35s cubic-bezier(.22,1,.36,1); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html.anim [data-anim]:not(.in) { opacity: 1; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
