/* DUCK CHI — 網站樣式 */
:root {
  --bg: #f4f5f5;
  --surface: #ffffff;
  --text: #2b2b2b;
  --muted: #8a9096;
  --nav: #9aa2a9;
  --nav-active: #24476b;
  --line: #dcdfe1;
  --accent: #d6603f;
  --wrap: 960px;
  --gap: 12px;
  --font: "Open Sans", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }

/* ---------- 頁首與選單 ---------- */
.site-header { background: var(--surface); text-align: center; padding: 28px 16px 8px; }
.brand {
  font-weight: 700; font-size: 22px; letter-spacing: .18em; text-decoration: none; color: #111;
}
.site-nav {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.site-nav.is-stuck { border-bottom-color: var(--line); }
.nav-inner {
  display: flex; justify-content: center; gap: 4px 36px; flex-wrap: wrap;
  max-width: var(--wrap); margin: 0 auto; padding: 14px 16px 18px;
}
.site-nav a {
  color: var(--nav); text-decoration: none; font-size: 13px; letter-spacing: .08em;
  padding: 4px 0; transition: color .15s;
}
.site-nav a:hover, .site-nav a:focus-visible { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--nav-active); }

/* ---------- 內容 ---------- */
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 40px 16px 24px; }
.intro { text-align: center; color: var(--muted); margin: 0 0 28px; }
.work-title { text-align: center; font-size: 26px; font-weight: 700; margin: 8px 0 4px; letter-spacing: .04em; }
.work-roles { text-align: center; color: var(--muted); margin: 0 0 32px; font-size: 15px; }
.section { font-size: 18px; font-weight: 700; color: #4a4f54; margin: 36px 0 14px; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 36px 0; }
.note { text-align: center; color: var(--muted); margin: 14px 0 24px; }
.links { text-align: center; display: flex; gap: 12px 24px; justify-content: center; flex-wrap: wrap; }
.links a { color: var(--nav-active); }
.missing { background: #fde8e4; color: #a33; padding: 16px; font-size: 14px; text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 圖片排列：一行幾張 */
.row { display: grid; gap: var(--gap); margin: 0 0 var(--gap); align-items: start; }
.row figure { margin: 0; min-width: 0; }
.cols-1 { grid-template-columns: 1fr; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-5 { grid-template-columns: repeat(5, 1fr); }
.cols-6 { grid-template-columns: repeat(6, 1fr); }
/* 同一排不同比例的圖：等高排列，寬度依比例分配 */
.row-flex { display: flex; }
.row-flex figure { flex: 1 1 0; }
.zoom { display: block; cursor: zoom-in; }
.zoom img { width: 100%; }

/* YouTube：點了才載入 */
.yt {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; border: 0;
  background: #111 center / cover no-repeat; cursor: pointer;
}
.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-play {
  position: absolute; left: 50%; top: 50%; width: 68px; height: 48px; transform: translate(-50%, -50%);
  background: rgba(20, 20, 20, .8); border-radius: 12px; transition: background .15s;
}
.yt-play::after {
  content: ""; position: absolute; left: 27px; top: 14px;
  border-style: solid; border-width: 10px 0 10px 17px; border-color: transparent transparent transparent #fff;
}
.yt:hover .yt-play, .yt:focus-visible .yt-play { background: #f00; }
.video-row { margin-bottom: 20px; }
.video-vertical-row { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.video-vertical-row figure { width: min(340px, 100%); }
.yt-vertical { aspect-ratio: 9 / 16; }

/* 幻燈片 */
.slideshow { position: relative; margin: 0 0 var(--gap); background: var(--surface); outline: none; }
.slides { display: grid; }
.slide { grid-area: 1 / 1; opacity: 0; transition: opacity .7s ease; pointer-events: none; }
.slide.is-active { opacity: 1; pointer-events: auto; }
.slide img { width: 100%; }
.ss-prev, .ss-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 56px; border: 0; background: rgba(0, 0, 0, .25); color: #fff;
  font-size: 32px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .2s, background .2s;
}
.ss-prev { left: 0; } .ss-next { right: 0; }
.slideshow:hover .ss-prev, .slideshow:hover .ss-next,
.ss-prev:focus-visible, .ss-next:focus-visible { opacity: 1; }
.ss-prev:hover, .ss-next:hover { background: rgba(0, 0, 0, .45); }
.ss-dots { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 8px; }
.ss-dots button { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .55); cursor: pointer; }
.ss-dots button[aria-current="true"] { background: #fff; }
.slide-link { display: block; }
/* 暫停／播放按鈕 */
.ss-toggle {
  position: absolute; left: 10px; bottom: 8px; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .35); cursor: pointer; opacity: .75; transition: opacity .2s, background .2s;
}
.ss-toggle:hover, .ss-toggle:focus-visible { opacity: 1; background: rgba(0, 0, 0, .55); }
.ss-toggle::before, .ss-toggle::after {
  content: ""; position: absolute; top: 9px; width: 3px; height: 10px; background: #fff; border-radius: 1px;
}
.ss-toggle::before { left: 10px; }
.ss-toggle::after { left: 15px; }
.ss-toggle.is-paused::before {
  left: 11px; top: 8px; width: 0; height: 0; background: none; border-radius: 0;
  border-style: solid; border-width: 6px 0 6px 9px; border-color: transparent transparent transparent #fff;
}
.ss-toggle.is-paused::after { display: none; }
/* 橫移幻燈片：從右往左滑進來 */
.slideshow.slide-x { overflow: hidden; }
.slide-x .slides { display: flex; align-items: flex-start; transition: transform .6s ease; will-change: transform; }
.slide-x .slide { flex: 0 0 100%; min-width: 0; opacity: 1; pointer-events: auto; transition: none; }
/* 好幾組幻燈片並排 */
.ss-group { display: grid; gap: var(--gap); margin: 0 0 var(--gap); }
.ss-group .slideshow { margin: 0; }

/* 作品縮圖 */
.tiles { display: grid; gap: var(--gap); }
.tiles-project { grid-template-columns: repeat(2, 1fr); }
.tiles-game-art { grid-template-columns: repeat(6, 1fr); }
.tiles-game-art .tile { grid-column: span 2; }
.tiles-game-art .tile:nth-child(-n+2) { grid-column: span 3; }
.tile { position: relative; display: block; overflow: hidden; background: var(--surface); }
.tile img { width: 100%; transition: transform .4s ease; }
.tile-name {
  position: absolute; inset: auto 0 0 0; padding: 22px 14px 10px; color: #fff; font-size: 14px; letter-spacing: .04em;
  background: linear-gradient(transparent, rgba(0, 0, 0, .55)); opacity: 0; transition: opacity .25s;
}
.tile:hover img, .tile:focus-visible img { transform: scale(1.03); }
.tile:hover .tile-name, .tile:focus-visible .tile-name { opacity: 1; }

/* 文字欄（ABOUT） */
.text-cols { display: grid; gap: 24px; margin: 32px 0; }
.text-cols h3 { font-size: 15px; letter-spacing: .1em; margin: 0 0 8px; }
.text-cols ul { list-style: none; margin: 0; padding: 0; color: #555; }
.text-cols li { padding: 2px 0; }
.page-about .text-cols { grid-template-columns: 1fr 1.5fr 1.5fr; }
.page-about .text-col:not(:last-child) ul { list-style: disc; padding-left: 1.3em; }
.page-about .text-cols .text-col:last-child { text-align: right; }
.page-about .text-cols .text-col:last-child li:first-child { color: var(--text); margin-bottom: 14px; }

/* ABOUT（含 Contact） */
.section { scroll-margin-top: 72px; }
.page-about > .row:first-child { max-width: 640px; margin: 0 auto 8px; }
.page-about > .row:first-child .zoom { cursor: default; pointer-events: none; }
.page-about .text-cols { margin-top: 8px; }

/* CONTACT / HOME */
.page-contact { max-width: 640px; }
.page-contact .row { max-width: 420px; margin: 32px auto 0; }
.page-contact .zoom { cursor: default; pointer-events: none; }
.page-home { padding-top: 32px; }

/* CONTACT */
.contact-list { list-style: none; padding: 0; margin: 16px 0; }
.contact-list li { display: flex; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.contact-list span { width: 92px; flex: none; color: var(--muted); font-size: 14px; }
.contact-list a { color: var(--nav-active); word-break: break-all; }

/* BACK / TOP */
.page-link { text-align: center; margin: 0; }
.page-link a { color: #818181; font-size: 14px; letter-spacing: .1em; }

/* 頁尾 */
.site-footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px 40px; }
.site-footer p { margin: 4px 0; }
.site-footer a { color: var(--muted); }

/* 放大看圖 */
.lightbox {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: rgba(15, 15, 15, .9); padding: 24px; cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 100%; width: auto; object-fit: contain; }
.lightbox button {
  position: absolute; border: 0; background: none; color: #fff; font-size: 36px; cursor: pointer; padding: 8px 14px; opacity: .8;
}
.lightbox button:hover { opacity: 1; }
.lb-close { top: 8px; right: 8px; }
.lb-prev { left: 4px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 4px; top: 50%; transform: translateY(-50%); }

/* ---------- 手機 ---------- */
@media (max-width: 700px) {
  .site-header { padding-top: 20px; }
  .nav-inner { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; gap: 22px; padding: 10px 16px 12px; scrollbar-width: none; }
  .nav-inner::-webkit-scrollbar { display: none; }
  .site-nav a { white-space: nowrap; }
  .wrap { padding-top: 28px; }
  .work-title { font-size: 22px; }
  .cols-3, .cols-4, .cols-5, .cols-6 { grid-template-columns: repeat(2, 1fr); }
  .row-flex.cols-4, .row-flex.cols-5, .row-flex.cols-6 { display: grid; }
  .ss-group.cols-3, .ss-group.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .video-row.cols-2, .video-row.cols-3 { grid-template-columns: 1fr; }
  .tiles-project { grid-template-columns: 1fr; }
  .tiles-game-art { grid-template-columns: repeat(2, 1fr); }
  .tiles-game-art .tile, .tiles-game-art .tile:nth-child(-n+2) { grid-column: span 1; }
  .text-cols { grid-template-columns: 1fr !important; }
  .page-about .text-cols .text-col:last-child { text-align: left; }
  .ss-prev, .ss-next { opacity: 1; width: 32px; height: 44px; font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .slide, .tile img { transition: none; }
}
