/* works.html — 作品館（部門頁、案例頁、角色頁）。Shared components live in case-ui.css. */
@view-transition { navigation: auto; }

body { background: var(--case-ground); font: 16px/1.75 "Avenir Next", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif; }
.shell { width: min(1200px, calc(100% - 48px)); }
.skip { position: fixed; top: 8px; left: 8px; z-index: var(--z-overlay); padding: .6rem 1rem; border-radius: 8px; background: #c2edff; color: #0b1328; transform: translateY(-200%); }
.skip:focus { transform: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.works-header nav a { display: inline-flex; align-items: center; min-height: 44px; font-size: .875rem; color: #c9d6ea; }
.works-header nav a[aria-current] { color: #fff; }

/* Department chips (sticky, horizontally scrollable) */
.dept-chips { position: sticky; top: 0; z-index: var(--z-sticky); display: flex; gap: .5rem; overflow-x: auto; scrollbar-width: none; padding: .75rem 0; margin-bottom: .5rem; background: linear-gradient(var(--case-ground) 80%, #09112100); }
.dept-chips::-webkit-scrollbar { display: none; }
.chip { position: relative; flex: none; display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: 0 1rem; border-radius: 999px; border: 1px solid var(--case-line-strong); color: #cdd8ea; font-size: .875rem; white-space: nowrap; transition: border-color .2s, color .2s; }
.chip:hover { border-color: #83e1f799; color: #fff; }
.chip .tnum { color: var(--case-quiet); }
.chip[aria-current] { border-color: var(--case-gold); color: #fff; padding-left: 1.6rem; }
.chip[aria-current]::before { content: ""; position: absolute; left: .8rem; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--case-gold); }

#app { outline: none; padding-bottom: 4rem; min-height: 60vh; }
.vt-title { view-transition-name: page-title; }

/* Breadcrumbs */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem .5rem; margin: 1.25rem 0 0; padding: 0; font-size: .8125rem; color: var(--case-quiet); }
.crumbs li + li::before { content: "/"; margin-right: .5rem; color: #4d5f80; }
.crumbs a { color: #b8c7dd; }
.crumbs a:hover { color: var(--case-sky); }

/* Page heads (demo.css styles every <header> as the site bar; reset for content headers) */
header.page-head, header.case-head { display: block; border-bottom: 0; }
header.role-head { display: flex; }
.works-intro { padding: 2.5rem 0 1rem; max-width: 48rem; }
.works-intro h1, .page-head h1, .case-head h1 { font-size: clamp(1.9rem, 4vw, 3rem); font-weight: 500; line-height: 1.3; letter-spacing: .02em; text-wrap: balance; }
.works-intro p { margin-top: 1rem; color: var(--case-muted); line-height: 1.9; }
.page-head { padding: 1.5rem 0 2rem; max-width: 48rem; }
.page-lede { margin-top: .9rem; color: var(--case-muted); font-size: 1.0625rem; line-height: 1.85; }
.page-meta { margin-top: .6rem; color: var(--case-quiet); font-size: .875rem; }
.role-head { display: flex; gap: 1.5rem; align-items: center; max-width: 56rem; }
.role-head img { flex: none; width: 112px; height: 112px; border-radius: 24px; border: 1px solid var(--case-line); object-fit: cover; }

/* Overview */
.overview-dept { padding: 2.5rem 0; border-top: 1px solid var(--case-line); }
.overview-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem 2rem; align-items: baseline; margin-bottom: 1.5rem; }
.overview-head h2 { font-size: 1.375rem; font-weight: 600; }
.overview-head .count { margin-left: .4rem; color: var(--case-quiet); font-size: .9375rem; font-weight: 400; }
.overview-head p { grid-column: 1; color: var(--case-muted); font-size: .9375rem; }
.overview-head .more-link { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.more-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--case-sky); font-size: .9375rem; }
.more-link:hover { color: #fff; }

/* Case grids */
.case-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 2.25rem 1.75rem; }
@media (min-width: 900px) {
  .dept-grid .case-card.is-lead { grid-column: span 2; grid-row: span 2; }
  .dept-grid .is-lead .case-title { font-size: 1.5rem; }
  .dept-grid .is-lead .case-proof { font-size: 1rem; }
  .dept-grid .is-lead .case-media { flex: 1; display: flex; flex-direction: column; }
  .dept-grid .is-lead .frame-window { flex: 1; aspect-ratio: auto; min-height: 320px; }
  .dept-grid .is-lead .frame-window img { position: absolute; inset: 0; }
}

/* Department roles */
.dept-roles { margin-bottom: 2.75rem; }
.dept-roles h2, .demos h2, .case-columns h2 { font-size: 1.125rem; font-weight: 600; color: #e6edf8; }
.dept-roles ul { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .75rem; }
.dept-roles a { display: flex; align-items: center; gap: .75rem; min-height: 56px; padding: .4rem 1rem .4rem .4rem; border-radius: 999px; border: 1px solid var(--case-line); transition: border-color .2s; }
.dept-roles a:hover { border-color: #83e1f799; }
.dept-roles img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.dept-roles strong { display: block; font-size: .9375rem; font-weight: 600; line-height: 1.4; }
.dept-roles small { display: block; color: var(--case-quiet); font-size: .78rem; }

/* Demos (操作體驗) — clearly separate from real cases */
.demos { margin-top: 4rem; padding: 2rem; border-radius: 18px; border: 1px dashed var(--case-line-strong); background: #0d172b; }
.demos-note { margin-top: .4rem; color: var(--case-quiet); font-size: .875rem; }
.demo-list { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 1rem; }
.demo-list a { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 1rem; align-items: center; padding: .6rem; border-radius: 12px; transition: background-color .2s; }
.demo-list a:hover { background: #a4beff0d; }
.demo-list img { width: 112px; height: 70px; border-radius: 8px; object-fit: cover; border: 1px solid var(--case-line); }
.demo-list small { display: block; color: var(--case-quiet); font-size: .75rem; }
.demo-list strong { display: block; font-size: .9375rem; font-weight: 600; line-height: 1.5; }
.demo-list em { display: block; font-style: normal; color: var(--case-muted); font-size: .8125rem; line-height: 1.6; }

/* Case page */
.case-head { padding: 1.5rem 0 1.5rem; max-width: 52rem; }
.case-head-client { color: #92b4d1; font-size: 1rem; margin-bottom: .4rem; }
.case-fulltitle { margin-top: .5rem; color: var(--case-quiet); font-size: .9375rem; }
.case-head-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin-top: 1rem; color: var(--case-quiet); font-size: .875rem; }
.dept-tag { display: inline-flex; align-items: center; min-height: 32px; padding: 0 .7rem; border-radius: 999px; border: 1px solid var(--case-line); color: #c6d3e6; font-size: .8125rem; }
.dept-tag:hover { border-color: var(--case-sky); color: #fff; }
.case-proof-big { margin-top: 1.1rem; font-size: 1.1875rem; line-height: 1.7; color: #eef3fa; }
.case-urls { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 2rem; }
.url-chip { display: inline-flex; flex-direction: column; justify-content: center; min-height: 52px; padding: .5rem 1.1rem; border-radius: 12px; border: 1px solid #83e1f74d; color: var(--case-sky); font-size: .9375rem; line-height: 1.45; transition: border-color .2s, background-color .2s; }
.url-chip:hover { border-color: var(--case-sky); background: #83e1f70f; color: #fff; }
.url-chip small { color: var(--case-quiet); font-size: .75rem; }
.no-url { color: var(--case-muted); font-size: .9375rem; }

/* Gallery */
.case-gallery { display: grid; gap: 1rem; }
.gallery-main { margin: 0; }
.gallery-window { position: relative; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 14px; border: 1px solid var(--case-line-strong); background: radial-gradient(ellipse at 50% 40%, #1b2a48, #0e182d 75%); }
.gallery-window img { display: block; width: 100%; height: 100%; object-fit: contain; }
.gallery-window.is-tall img { height: auto; object-fit: initial; transition: transform 6s linear; }
.gallery-window.is-tall:hover img, .gallery-window.is-tall:focus-visible img { transform: translateY(var(--pan, 0)); }
.gallery-main figcaption, .gallery-video figcaption { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .6rem; color: var(--case-muted); font-size: .875rem; }
.media-tag-inline { padding: 1px 8px; border-radius: 6px; border: 1px solid var(--case-line-strong); color: #e6edf8; font-size: .75rem; }
.gallery-video video { aspect-ratio: 16 / 9; background: #000; }
.gallery-rail { list-style: none; margin: 0; padding: 0 0 .5rem; display: grid; grid-auto-flow: column; grid-auto-columns: 168px; gap: .75rem; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.gallery-rail li { scroll-snap-align: start; }
.rail-item { position: relative; display: block; width: 100%; aspect-ratio: 16 / 10; padding: 0; overflow: hidden; border-radius: 10px; border: 1px solid var(--case-line); background: #111c33; cursor: pointer; }
.rail-item img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.rail-item.is-current { border-color: var(--case-gold); box-shadow: 0 0 0 1px var(--case-gold); }
.rail-item:hover { border-color: #83e1f799; }
.rail-item .media-tag { left: 6px; bottom: 6px; font-size: .65rem; padding: 1px 6px; }

.case-columns { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 3rem; margin-top: 3rem; }
.done-list { margin: 1rem 0 0; padding-left: 1.2rem; color: var(--case-muted); line-height: 1.9; max-width: 38em; text-wrap: pretty; }
.done-list li + li { margin-top: .5rem; }
.who-list { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 1rem; }
.who-list li { padding-bottom: 1rem; border-bottom: 1px solid var(--case-line); }
.who-list a { display: inline-flex; align-items: center; gap: .65rem; min-height: 44px; }
.who-list a:hover strong { color: var(--case-sky); }
.who-list img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.who-list strong { font-weight: 600; }
.who-list p { margin-top: .25rem; color: var(--case-muted); font-size: .875rem; line-height: 1.75; }
.evidence { display: inline-block; margin-top: .4rem; color: var(--case-quiet); font-size: .75rem; }
.tag-note, .muted-note { margin-top: 1rem; color: var(--case-quiet); font-size: .8125rem; line-height: 1.8; }
.case-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px solid var(--case-line); }
.case-pager a { display: grid; min-height: 56px; padding: .6rem .9rem; border-radius: 12px; font-size: .9375rem; line-height: 1.5; transition: background-color .2s; }
.case-pager a:hover { background: #a4beff0d; }
.case-pager a[rel="next"] { text-align: right; }
.case-pager small { color: var(--case-quiet); font-size: .75rem; }

/* Role page */
.role-cases { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 2.5rem 1.75rem; }
.role-scope { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--case-line); color: var(--case-muted); font-size: .875rem; line-height: 1.75; }
.role-scope span { display: block; color: var(--case-quiet); font-size: .75rem; }
.role-back { margin-top: 2.5rem; }
.role-back a { color: var(--case-sky); }

.works-empty { padding: 2rem 0; color: var(--case-muted); }
.works-empty a { color: var(--case-sky); }
.works-footer { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; padding: 2rem 0 3rem; border-top: 1px solid var(--case-line); color: var(--case-quiet); font-size: .8125rem; line-height: 1.8; }
.works-footer p { max-width: 44rem; }
.works-footer nav { display: flex; gap: 1.25rem; font-size: .875rem; }

::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }
::view-transition-group(*) { animation-duration: .38s; animation-timing-function: cubic-bezier(.25, 1, .5, 1); }

@media (max-width: 760px) {
  .shell { width: calc(100% - 32px); }
  .works-header { gap: 12px; }
  .works-header nav { gap: 14px; }
  .overview-head { grid-template-columns: 1fr; }
  .overview-head .more-link { grid-column: 1; grid-row: auto; }
  .case-columns { grid-template-columns: 1fr; gap: 2rem; }
  .role-head { flex-direction: column; align-items: flex-start; }
  .demos { padding: 1.25rem; }
  .gallery-rail { grid-auto-columns: 132px; }
  .case-pager { grid-template-columns: 1fr; }
  .case-pager a[rel="next"] { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .gallery-window.is-tall img { transition: none; }
  .gallery-window.is-tall:hover img { transform: none; }
}
