/* ==================================================================
   PROJECT21 — specimen framework
   The frame is small, gridded, and typographic. The work is large.
   Each project contributes exactly one colour (--accent), sampled
   from its own imagery; nothing else is borrowed or invented.
   ================================================================== */

:root {
  --paper:   #F2F0EA;
  --paper-2: #E8E5DC;   /* plate field */
  --ink:     #131310;
  --ink-2:   #1B1B17;   /* dark chapters */
  --muted:   #6B6A61;
  --line:    rgba(19, 19, 16, .16);
  --line-2:  rgba(19, 19, 16, .08);
  --seal:    #A8322A;   /* the studio's only mark colour */
  --accent:  var(--seal);

  --pad: clamp(1.1rem, 3.2vw, 3.25rem);
  --gap: clamp(1rem, 2vw, 2rem);
  --bar: 3.5rem;

  --sans: "Helvetica Neue", Helvetica, "PingFang TC", "Noto Sans TC",
          "Microsoft JhengHei", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
          "PingFang TC", "Noto Sans TC", monospace;
  --zh:   "PingFang TC", "Noto Sans TC", "Noto Sans CJK TC", "Microsoft JhengHei",
          "Helvetica Neue", Helvetica, sans-serif;

  --t: .45s cubic-bezier(.22, .68, .28, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--bar) + 1rem); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  transition: background-color 1.4s ease;   /* colour weather: tint set by site.js */
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.dialog-open { overflow: hidden; }
::selection { background: var(--seal); color: var(--paper); }
h1, h2, h3, p, ol, ul, figure { margin: 0; }
ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
img { display: block; width: 100%; height: auto; }

:focus-visible {
  outline: 2px solid var(--seal);
  outline-offset: 3px;
}
.chapter--studio :focus-visible,
body > footer :focus-visible { outline-color: var(--paper); }


.skip-link {
  position: fixed; left: 1rem; top: -5rem; z-index: 200;
  padding: .8rem 1.1rem; background: var(--ink); color: var(--paper);
  font: 500 .75rem/1 var(--mono); letter-spacing: .06em;
}
.skip-link:focus { top: 1rem; }

/* ---------- duo type: English first, Traditional Chinese paired ---- */
[lang="zh-Hant"] { font-family: var(--zh); letter-spacing: 0; }
/* inline pairs — nav, chips, captions, list items */
.chapters a [lang="zh-Hant"], .chip [lang="zh-Hant"], .text-link [lang="zh-Hant"],
.services li li [lang="zh-Hant"], .contact dt [lang="zh-Hant"], .contact dd [lang="zh-Hant"],
.hero-plate figcaption [lang="zh-Hant"], .skip-link [lang="zh-Hant"], .case-close [lang="zh-Hant"],
.case-return [lang="zh-Hant"], .next-label [lang="zh-Hant"], .read-toggle [lang="zh-Hant"] {
  margin-left: .35em; font-size: .94em; opacity: .72;
}
/* stacked pairs — headings, lead text, scopes */
h2 .zh, h2 [lang="zh-Hant"], h3 [lang="zh-Hant"], .plate-scope .zh, .case-scope .zh, .case-cat .zh,
.studio-lead .zh, .index-empty .zh {
  display: block;
}
h2 [lang="zh-Hant"] { margin-top: .45rem; font-size: .42em; font-weight: 400; color: var(--muted); line-height: 1.4; }
h3 [lang="zh-Hant"] { margin-top: .2rem; font-size: .78em; font-weight: 400; color: var(--muted); }

.text-link {
  display: inline-flex; align-items: center; gap: .7rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid currentColor;
  font: 500 .78rem/1 var(--mono);
  letter-spacing: .08em; text-transform: uppercase;
}
.text-link i { font-style: normal; transition: transform var(--t); }
.text-link:hover i { transform: translateY(.2rem); }
.text-link--sm { border-bottom-color: rgba(242,240,234,.4); }
.text-link--sm:hover i { transform: translateY(-.2rem); }

/* =================================================================
   LIVING BACKGROUND — colour weather + light field
   One fixed layer under all content. Two .wx children crossfade: each
   carries a faint accent tint over paper and three soft glows in the
   current project's accent and its neighbour. Sections with their own
   background (Studio, Services, kaleidoscope, footer) cover it.
   ================================================================= */
.weather {
  position: fixed; inset: var(--bar) 0 0 0; z-index: -1; pointer-events: none;
  overflow: hidden; contain: strict;   /* starts under the header, so its backdrop blur never re-filters the glows */
}
.wx {
  position: absolute; inset: -12vh -8vw; opacity: 0; visibility: hidden;   /* oversized: drift never shows an edge */
  will-change: transform;
  transition: opacity 1.4s ease, visibility 0s linear 1.4s;   /* off layer leaves compositing after the fade */
}
.wx.is-on { opacity: 1; visibility: visible; transition-delay: 0s; }
.glow {
  position: absolute; display: block; border-radius: 50%;
  width: 52vmax; height: 52vmax;
  background: radial-gradient(circle at center, var(--g) 0%, color-mix(in srgb, var(--g) 40%, transparent) 28%, transparent 62%);
  opacity: .16;
}
.glow { transition: opacity .9s ease; }
.weather.in-work .glow { opacity: 0; }          /* the dimension takes over from the light field */
/* background kaleidoscope — the focused project's dimension, very quiet.
   Drawn at ¼ resolution and scaled up, which softens it without filter:blur. */
.dim {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; transition: opacity .9s ease;
}
.dim.is-on { opacity: var(--dim-op, .085); }
.glow.g1 { left: -18vmax; top: -24vmax; --g: var(--wx, var(--seal)); }
.glow.g2 { right: -24vmax; top: 28vh;  --g: var(--wx2, var(--wx, var(--seal))); opacity: .12; }
@media (max-width: 620px) { .glow { width: 100vmax; height: 100vmax; } }

/* =================================================================
   HEADER
   ================================================================= */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
}
.site-header { transition: transform .35s cubic-bezier(.2,.7,.2,1); }
.site-header.is-tucked { transform: translateY(-100%); }
.header-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: clamp(1rem, 3vw, 3rem);
  min-height: var(--bar);
  padding: 0 var(--pad);
}
.wordmark {
  font-size: 1rem; font-weight: 600; letter-spacing: -.045em; white-space: nowrap;
}
.wordmark span {
  display: inline-block; padding: .08rem .22rem; margin-left: .1rem;
  background: var(--seal); color: var(--paper);
}
.chapters { display: flex; justify-content: flex-end; gap: clamp(1rem, 2.2vw, 2.4rem); }
.chapters a {
  position: relative; padding: .3rem 0;
  font: 500 .78rem/1 var(--mono);
  letter-spacing: .06em;
  color: var(--muted);
  transition: color var(--t);
}
.chapters a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -.05rem;
  height: 1px; background: var(--seal);
  transform: scaleX(0); transform-origin: left;
  transition: transform var(--t);
}
.chapters a:hover { color: var(--ink); }
.chapters a.is-current { color: var(--ink); }
.chapters a.is-current::after,
.chapters a:hover::after { transform: scaleX(1); }

.chapter-progress {
  display: block; height: 2px;
  background: var(--thread, var(--seal));
  transform: scaleX(0); transform-origin: left;
  will-change: transform;
  transition: background-color 1.4s ease;
}

/* =================================================================
   HERO
   ================================================================= */
/* name frame — the 14 project names run round the hero's edge, like the
   border text on a stamp. One SVG path; SMIL moves the text along it. */
.name-frame {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; overflow: visible; z-index: 0;
}
.name-frame text {
  font: 500 10.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase;
  fill: var(--muted); fill-opacity: .62;
}
.name-frame .nf-sep { fill-opacity: .35; }
.name-frame.has-sheen text { fill: url(#nf-sheen); fill-opacity: 1; }
.name-frame .nf-s0 { stop-color: var(--muted); stop-opacity: .62; }
.name-frame .nf-s1 { stop-color: var(--nf-accent, var(--seal)); stop-opacity: 1; transition: stop-color 1.2s ease; }
.hero > :not(.name-frame) { position: relative; z-index: 1; }

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: end;
  padding: clamp(3.3rem, 6vh, 4rem) var(--pad) clamp(5rem, 9vh, 6rem);   /* room for the two-ring name frame */
  border-bottom: 1px solid var(--line);
}
.hero-copy {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1.6rem;
  padding-bottom: clamp(0rem, 4vh, 2.5rem);
}
h1 {
  display: grid; gap: .9rem;
  font-size: clamp(2.2rem, 4.4vw, 4.2rem);
  font-weight: 500; line-height: 1.1; letter-spacing: -.03em;
}
/* headline: two lines, no connector — the second drawn in outline, the
   same voice as the outlined title inside a project */
h1 .en { display: grid; }
h1 .h-line { display: block; white-space: nowrap; }
h1 .h-out { color: transparent; -webkit-text-stroke: max(1px, .022em) var(--ink); }
@supports not (-webkit-text-stroke: 1px black) { h1 .h-out { color: var(--muted); } }
h1 .zh {
  max-width: 26em;
  font-size: .44em; font-weight: 400; line-height: 1.5; letter-spacing: .04em; color: var(--muted);
}

.hero-plate { position: relative; align-self: end; }
button.hero-frame {
  display: block; padding: 0; border: 0; font: inherit; color: inherit; cursor: pointer;
}
button.hero-frame:focus-visible { outline: 2px solid var(--seal); outline-offset: 4px; }
.hero-plate { justify-self: end; width: fit-content; max-width: 100%; }
.hero-frame {
  position: relative; overflow: hidden;
  aspect-ratio: 3 / 4; height: min(80vh, 46rem);
  background: var(--paper-2);
}
.hero-plate .hero-frame img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  max-height: none; margin: 0; aspect-ratio: auto; object-fit: cover;
}
.hero-frame img { opacity: 0; transform-origin: 50% 60%; }
.hero-frame img.was-on { opacity: 1; z-index: 1; }              /* holds under the wipe */
.hero-frame img.is-on {
  opacity: 1; z-index: 2;
  animation: hero-wipe .9s cubic-bezier(.65,0,.2,1) both;      /* no zoom: the frame never changes size */
}
.hero-frame img.is-first { animation: none; }                   /* first plate: no wipe */
@keyframes hero-wipe  { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0); } }
.hero-tick {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: block; height: 2px;
  background: var(--hero-accent, var(--seal));
  transform: scaleX(0); transform-origin: left;
  transition: background-color .8s ease;
}
.hero-tick.is-running { animation: hero-tick var(--hero-ms, 5600ms) linear both; }
@keyframes hero-tick { to { transform: scaleX(1); } }
.hero-open {
  display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0 .4em;
  text-align: left; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit;
  transition: opacity .35s ease;
}
.hero-open.is-swapping { opacity: 0; }
.hero-open i { font-style: normal; transition: transform var(--t); }
.hero-open:hover { color: var(--ink); }
.hero-open:hover i { transform: translate(.15rem, -.15rem); }
.hero-name { color: var(--ink); }

/* plate peek — hover shows an image from inside the project */
.plate-peek {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transition: opacity .55s ease, transform .9s cubic-bezier(.2,.75,.15,1);
  transform: scale(1.03);
}
.plate:hover .plate-peek.is-ready, .plate:focus-visible .plate-peek.is-ready { opacity: 1; transform: scale(1); }

.hero-plate img {
  aspect-ratio: 3 / 4; object-fit: cover;
  max-height: min(72vh, 42rem); margin-left: auto;
  background: var(--paper-2);
}
.hero-plate figcaption {
  padding-top: .7rem;
  font: 500 .66rem/1.4 var(--mono);
  letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
}

/* =================================================================
   CHAPTERS — shared
   ================================================================= */
.chapter { padding: clamp(3.5rem, 7vw, 6.5rem) var(--pad); }
.chapter-head {
  display: flex; flex-wrap: wrap; gap: 1rem 2rem;
  align-items: flex-end; justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  margin-bottom: clamp(1.8rem, 4vw, 3.2rem);
}
.chapter-head h2 {
  font-size: clamp(1.5rem, 2.6vw, 2.3rem);
  font-weight: 500; line-height: 1.06; letter-spacing: -.03em;
}

/* =================================================================
   WORK
   ================================================================= */
.chips { display: flex; flex-wrap: wrap; gap: .2rem 1.1rem; padding-bottom: .35rem; }
.chip {
  padding: .3rem 0;
  border-bottom: 1px solid transparent;
  font: 500 .7rem/1 var(--mono); letter-spacing: .04em;
  color: var(--muted);
  transition: color var(--t), border-color var(--t);
}
.chip:hover { color: var(--ink); }
.chip.is-active { color: var(--ink); border-bottom-color: var(--ink); }
.index-empty {
  padding: 4rem 0; color: var(--muted);
  font: 500 .8rem/1.6 var(--mono); letter-spacing: .06em;
}

/* ---------- plates view ------------------------------------------ */
.index {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr));
  gap: clamp(2rem, 3.4vw, 3.4rem) var(--gap);
}
.plate {
  display: grid; gap: .7rem;
  text-align: left;
  position: relative;
}
.plate::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; z-index: 1;
  background: var(--accent);
  transform: scaleX(0); transform-origin: left;
  transition: transform var(--t);
}
.plate:hover::before, .plate:focus-visible::before { transform: scaleX(1); }

.plate-frame, .plate-foot { transition: opacity .55s ease, transform .55s cubic-bezier(.2,.75,.15,1); }
.index.has-focus .plate:not(.is-focus):not(:hover):not(:focus-within) .plate-frame { opacity: .66; transform: scale(.975); }
.index.has-focus .plate:not(.is-focus):not(:hover):not(:focus-within) .plate-foot  { opacity: .62; }
/* paper veil under captions and filters, so text stays readable over the dimension */
.plate-foot { padding: .3rem .45rem .35rem; margin: -.3rem -.45rem 0; border-radius: 2px;
  background: color-mix(in srgb, var(--paper) 86%, transparent); }
.chapter--work .chapter-head { padding-inline: .45rem; padding-bottom: .4rem; margin-inline: -.45rem;
  background: color-mix(in srgb, var(--paper) 86%, transparent); }
.plate-frame {
  position: relative; display: block; overflow: hidden;
  aspect-ratio: 4 / 3;
  background: color-mix(in srgb, var(--accent) 7%, var(--paper-2));
}
.plate-frame img {
  width: 100%; height: 100%;
  object-fit: contain;            /* never crop a supplied title plate */
  transition: transform .7s cubic-bezier(.2,.75,.15,1);
}
.plate:hover .plate-frame img { transform: scale(1.018); }
.plate-cue {
  position: absolute; right: .55rem; bottom: .55rem;
  padding: .35rem .55rem;
  background: var(--ink); color: var(--paper);
  font: 500 .6rem/1 var(--mono); letter-spacing: .09em; text-transform: uppercase;
  opacity: 0; transform: translateY(.35rem);
  transition: opacity var(--t), transform var(--t);
}
.plate:hover .plate-cue, .plate:focus-visible .plate-cue { opacity: 1; transform: none; }
/* desktop: the cue follows the cursor instead of sitting in the corner */
@media (hover: hover) and (pointer: fine) {
  .plate-cue {
    right: auto; bottom: auto; left: 0; top: 0;
    padding: .45rem .65rem; white-space: nowrap;
    transform: translate(var(--cx, -100px), var(--cy, -100px)) translate(-50%, -50%) scale(.85);
    transition: opacity .25s ease, transform .18s cubic-bezier(.2,.75,.15,1);
    will-change: transform;
  }
  .plate:hover .plate-cue {
    transform: translate(var(--cx, -100px), var(--cy, -100px)) translate(-50%, -50%) scale(1);
  }
  .plate:focus-visible:not(:hover) .plate-cue { transform: translate(1rem, 1rem); }
  .plate-cue [lang="zh-Hant"] { margin-left: .4em; opacity: .75; }
}

.plate-foot { display: grid; gap: .22rem; }
.plate-name {
  font-size: .9rem; font-weight: 600; letter-spacing: -.012em;
}
.plate-scope {
  font: 400 .68rem/1.5 var(--mono);
  letter-spacing: .02em; color: var(--muted);
}
.plate-scope .zh { font-size: .95em; }

/* =================================================================
   KALEIDOSCOPE — a band between Work and Studio. Drawn on a canvas
   from the cover of the last project seen; turns with the scroll.
   ================================================================= */
.kaleido {
  height: min(65vh, 40rem);
  background: var(--ink-2);
  overflow: hidden;
  border-top: 1px solid var(--line);
}
.kaleido canvas { display: block; width: 100%; height: 100%; }
@media (max-width: 620px) { .kaleido { height: 50vh; } }

/* =================================================================
   FLOW 流 — the second way to browse the work (Grid 格 is the first).
   Full Flow on pointer screens with motion: one plate in front, the
   neighbours peeking at depth over the kaleidoscope. Lite Flow on
   phones, touch and reduced motion: the same row as a snap strip.
   ================================================================= */
.work-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .4rem 2rem; }
.views { display: flex; gap: .2rem 1.1rem; padding-bottom: .35rem; }
.views[hidden] { display: none; }
body[data-view="flow"] #project-index { display: none; }
.fx[hidden] { display: none; }

.fx-flow {
  position: relative; margin-inline: calc(var(--pad) * -1);
  background: var(--ink-2); color: var(--paper);
  --accent: var(--seal);
}
.fx-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  animation: fx-hue 26s linear infinite, fx-breathe 9s ease-in-out infinite alternate;
  transform-origin: 50% 50%;
}
@keyframes fx-hue { from { filter: hue-rotate(0deg) saturate(1.5) contrast(1.08); } to { filter: hue-rotate(360deg) saturate(1.5) contrast(1.08); } }
@keyframes fx-breathe { from { transform: scale(1); } to { transform: scale(1.08); } }
.fx-item .plate-frame { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 60%, transparent), 0 18px 60px -10px color-mix(in srgb, var(--accent) 55%, #000); }
.fx-item .plate-foot { display: none; }        /* the caption under the row carries the words */
.fx-item::before { display: none; }
.fx-item .plate-frame { aspect-ratio: 4 / 3; }

/* the stage */
.fx-stage {
  position: relative; height: max(32rem, 84vh); overflow: hidden;
  perspective: 1600px; cursor: grab; touch-action: pan-y; user-select: none;
}
.fx-stage.is-dragging { cursor: grabbing; }
.fx-stage .fx-item {
  position: absolute; left: 50%; top: 46%; width: var(--cw, 40rem);
  will-change: transform, opacity; backface-visibility: hidden;
  transition: none;
}
.fx-stage .fx-item .plate-frame { background: color-mix(in srgb, var(--accent) 10%, var(--ink-2)); }
.fx-stage .fx-item { cursor: pointer; }
.fx-stage .fx-item.is-front .plate-frame { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 80%, transparent), 0 30px 90px -14px color-mix(in srgb, var(--accent) 70%, #000); }
.fx-hint {
  position: absolute; left: var(--pad); top: 1rem; z-index: 60;
  font: 500 .66rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase;
  color: rgba(242,240,234,.6); pointer-events: none;
}
.fx-hint [lang="zh-Hant"] { text-transform: none; margin-left: .4em; }

/* caption: ‹  NAME · category · 3 / 14  › */
.fx-cap {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 60;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center;
  padding: .4rem var(--pad) .9rem;
  font: 500 .68rem/1.5 var(--mono); letter-spacing: .1em; text-transform: uppercase;
  color: rgba(242,240,234,.85);
  background: linear-gradient(transparent, color-mix(in srgb, var(--ink-2) 80%, transparent));
  pointer-events: none;
}
.fx-cap-text {
  justify-self: center; display: flex; flex-wrap: wrap; justify-content: center; gap: .2rem 1rem; text-align: center;
  padding: .45rem .9rem; border-radius: 2px;
  background: color-mix(in srgb, var(--ink-2) 72%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.fx-cap-name { color: var(--paper); }
.fx-cap-name::after { content: "·"; margin-left: 1rem; opacity: .5; }
.fx-cap-cat .zh { text-transform: none; letter-spacing: 0; margin-left: .4em; opacity: .75; }
.fx-cap-n { opacity: .6; }
.fx-arrow {
  pointer-events: auto; min-width: 44px; min-height: 44px;
  display: grid; place-items: center;
  color: var(--paper); font: 400 1.6rem/1 var(--mono); opacity: .75; transition: opacity var(--t), transform var(--t);
}
.fx-arrow:hover { opacity: 1; transform: scale(1.1); }
.fx-arrow i { font-style: normal; transform: translateY(-.08em); }

.fx-flow:not(.fx-flow--lite) .fx-cap {
  top: calc(46% + var(--cw, 40rem) * .375 + .7rem); bottom: auto;     /* right under the plate in front */
  background: none;
}
/* lite Flow: snap strip */
.fx-flow--lite { padding-bottom: 3.4rem; }
.fx-snap {
  display: flex; gap: 3vw; align-items: center;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  padding: 1.6rem calc(50% - min(40vw, 20rem)) 1.2rem;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.fx-snap::-webkit-scrollbar { display: none; }
.fx-snap .fx-item { flex: 0 0 min(80vw, 40rem); scroll-snap-align: center; scroll-snap-stop: always; }
.fx-flow--lite .fx-cap { bottom: 0; padding-top: 0; }
.fx-flow--lite .fx-item .plate-frame { background: color-mix(in srgb, var(--accent) 10%, var(--ink-2)); }

/* =================================================================
   STUDIO
   ================================================================= */
.chapter--studio { background: var(--ink-2); color: var(--paper); }
.chapter--studio .chapter-head { border-top-color: rgba(242,240,234,.22); }
.chapter--studio h2 [lang="zh-Hant"] { color: rgba(242,240,234,.6); }
.studio-body { display: grid; gap: 1.6rem; max-width: 64rem; }
.studio-lead {
  display: grid; gap: 1rem;
  max-width: 34em;
  font-size: clamp(1.1rem, 1.7vw, 1.5rem);
  line-height: 1.32; letter-spacing: -.015em;
}
.studio-lead .zh {
  max-width: 34em;
  font-size: .68em; line-height: 1.75; color: rgba(242,240,234,.66);
}

/* ---------- Read 閱讀 — compact text, expands to two columns ----- */
.read-full {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1.5rem clamp(2rem, 5vw, 5rem);
  align-items: start;
}
.read-full[hidden], .read-compact[hidden] { display: none; }
.read-col { display: grid; gap: 1rem; font-size: .95rem; line-height: 1.68; }
.read-col[lang="zh-Hant"] { font-size: .9rem; line-height: 1.9; }
.chapter--studio .read-col { color: rgba(242,240,234,.78); }
.signoff {
  padding-top: .9rem; margin-top: .2rem;
  border-top: 1px solid var(--line);
  font-size: .86em; opacity: .7;
}
.chapter--studio .signoff { border-top-color: rgba(242,240,234,.22); }
.read-toggle {
  justify-self: start;
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .3rem 0;
  border-bottom: 1px solid currentColor;
  font: 500 .7rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  opacity: .72; transition: opacity var(--t);
}
.read-toggle:hover { opacity: 1; }
.read-toggle i { font-style: normal; transition: transform var(--t); }
.read.is-open .read-toggle i { transform: rotate(45deg); }
.read-toggle .read-less, .read.is-open .read-toggle .read-more { display: none; }
.read.is-open .read-toggle .read-less { display: inline; }
.read-toggle [lang="zh-Hant"] { text-transform: none; }

/* =================================================================
   SERVICES
   ================================================================= */
.chapter--services { background: var(--paper-2); }
.services {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0; padding: 0; list-style: none;
}
.services > li {
  display: grid; align-content: start; gap: .9rem;
  padding: .2rem 1.4rem 2rem 0;
  position: relative;
}
.services > li + li { padding-left: 1.4rem; border-left: 1px solid var(--line); }
.services h3 {
  display: grid; gap: .15rem;
  font-size: .98rem; font-weight: 600; letter-spacing: -.015em; line-height: 1.25;
}
.services ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .3rem; }
.services li li {
  font: 400 .8rem/1.5 var(--sans); color: var(--muted);
}

/* =================================================================
   CONTACT
   ================================================================= */
.chapter--contact { border-top: 1px solid var(--line); overflow-x: clip; }
/* the call: two lines that slide past each other as the section arrives,
   the outlined one in the colour of the last work you looked at */
.contact-head { display: grid; justify-content: stretch; gap: 1.1rem; }
.contact-eyebrow { font: 500 .7rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.contact-eyebrow [lang="zh-Hant"] { text-transform: none; letter-spacing: 0; margin-left: .4em; }
.contact-call { display: grid; gap: .1rem; }
.contact-call .ct-line {
  display: block; white-space: nowrap;
  font-size: clamp(3rem, 9vw, 8.5rem); font-weight: 500; line-height: .92; letter-spacing: -.05em;
}
.contact-call .ct-out {
  color: transparent; -webkit-text-stroke: max(1px, .018em) var(--thread, var(--seal));
  transition: -webkit-text-stroke-color 1.2s ease;
  padding-left: .55em;
}
@supports not (-webkit-text-stroke: 1px black) { .contact-call .ct-out { color: var(--muted); } }
.contact-call .ct-zh { margin-top: .9rem; font-size: clamp(1rem, 1.7vw, 1.4rem); font-weight: 400; letter-spacing: .06em; color: var(--muted); }
@supports (animation-timeline: view()) {
  .contact-call .ct-line { animation: ct-in 1ms linear both; animation-timeline: view(); animation-range: entry 0% cover 45%; }
  .contact-call .ct-out { animation-name: ct-in-r; }
  @keyframes ct-in   { from { transform: translateX(-9%); } to { transform: none; } }
  @keyframes ct-in-r { from { transform: translateX(14%); } to { transform: none; } }
}
.contact {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem clamp(1.5rem, 4vw, 4rem);
  margin: 0; max-width: 64rem;
}
.contact > div { display: grid; align-content: start; gap: .45rem; }
.contact dt {
  font: 500 .66rem/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.contact dt [lang="zh-Hant"] { text-transform: none; letter-spacing: 0; }
.contact dd { margin: 0; display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; font-size: 1rem; }
.contact dd a {
  display: inline-flex; align-items: baseline; gap: .4rem;
  border-bottom: 1px solid var(--line); transition: border-color var(--t);
}
.contact dd a:hover { border-bottom-color: var(--ink); }
.contact dd a i { font-style: normal; font-size: .8em; color: var(--muted); }

/* =================================================================
   FOOTER
   ================================================================= */
body > footer {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: end;
  gap: 1rem;
  min-height: 11rem; padding: var(--pad);
  background: var(--ink); color: var(--paper);
}
body > footer .wordmark span { background: var(--paper); color: var(--ink); }
.colophon {
  font: 500 .68rem/1 var(--mono); letter-spacing: .08em;
  color: rgba(242,240,234,.6); text-align: center;
}
body > footer .text-link { justify-self: end; }

/* =================================================================
   CASE STUDY
   ================================================================= */
.case {
  width: 100%; max-width: none; height: 100%; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: var(--paper); color: var(--ink);
}
.case::backdrop { background: rgba(19,19,16,.55); }
.case-shell { position: relative; z-index: 1; min-height: 100%; padding-bottom: 0; }
/* the project's own dimension, behind its pages — sticky so it fills the
   view while the case scrolls; quarter-resolution, very quiet */
.case-dim {
  position: sticky; top: 0; display: block;
  width: 100%; height: 100vh; height: 100dvh; margin-bottom: -100vh; margin-bottom: -100dvh;
  opacity: 0; transition: opacity .9s ease .25s; pointer-events: none;
}
.case-dim { will-change: opacity, transform; transition: opacity .9s ease .25s, transform .6s ease; }
.case-dim.is-on { opacity: calc(.07 + var(--dim-open, 0) * .06); transition: opacity .45s ease, transform .6s ease; }
/* the near layer: an inner ring, turning the other way, a touch stronger.
   A centred square, faded to nothing at its rim inside the canvas — small
   to composite, no CSS mask. */
.case-dim--near {
  position: absolute; left: 50%; top: 50%; margin: 0;
  width: min(108vh, 100vw); height: min(108vh, 100vw);
  transform: translate(-50%, -50%) scale(calc(1 + var(--dim-open, 0) * .07));
}
.case-dim--near.is-on { opacity: calc(.1 + var(--dim-open, 0) * .1); }
/* paper veil under the case's text so it reads cleanly over the dimension */
.case-intro, .case-cat { position: relative; }
.case-head { background: linear-gradient(color-mix(in srgb, var(--paper) 82%, transparent), color-mix(in srgb, var(--paper) 82%, transparent)); }
/* the veil is thinner now, so the small grey labels on it go a step darker */
.case-track .case-cat, .case-track .case-scope, .case-sheet-title { color: color-mix(in srgb, var(--ink) 45%, var(--muted)); }

.case-bar {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: auto 1fr auto auto auto; align-items: center; gap: 1rem clamp(.8rem, 2.2vw, 2rem);
  padding: .85rem var(--pad);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.case-bar-mark { width: 1.6rem; height: 2px; background: var(--accent); }
.case-bar-title {
  font: 500 .72rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.case-close {
  display: inline-flex; align-items: center; gap: .5rem;
  font: 500 .72rem/1 var(--mono); letter-spacing: .09em; text-transform: uppercase;
}
.case-close i { font-style: normal; font-size: 1.05rem; line-height: 1; }
.case-close:hover { color: var(--seal); }
/* ‹ Prev / Next › — swap the project in place, same spot in the bar wherever you are */
.case-steps { display: inline-flex; align-items: center; gap: .2rem; }
.case-step {
  display: inline-flex; align-items: center; gap: .4rem;
  min-height: 44px; padding: 0 .5rem;
  font: 500 .72rem/1 var(--mono); letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink); transition: color var(--t), opacity var(--t);
}
.case-step [lang="zh-Hant"] { text-transform: none; }
.case-step i { font-style: normal; font-size: 1.35rem; line-height: 1; color: var(--accent); transform: translateY(-.06em); }
.case-step:hover { color: var(--seal); }
.case-step[disabled] { opacity: .3; pointer-events: none; }
.case-steps[hidden] { display: none; }
.case-bar { padding-block: .35rem; min-height: 3.2rem; }
/* Read 閱讀 — fixed in the bar, beside Close */
.case-info {
  display: inline-flex; align-items: center; gap: .5rem;
  font: 500 .72rem/1 var(--mono); letter-spacing: .09em; text-transform: uppercase;
}
.case-info [lang="zh-Hant"] { text-transform: none; }
.case-info i { font-style: normal; font-size: 1.05rem; line-height: 1; color: var(--accent); transition: transform var(--t); }
.case-info:hover { color: var(--seal); }
.case-info .ci-shut, .sheet-open .case-info .ci-open { display: none; }
.sheet-open .case-info .ci-shut { display: inline; }
.sheet-open .case-info i { transform: rotate(45deg); }

.case-shell { position: relative; }
.case-sheet {
  position: absolute; z-index: 20; right: 0; top: var(--bar-h, 3rem); bottom: 0;
  width: min(32rem, 92vw); overflow-y: auto; overscroll-behavior: contain;
  display: grid; align-content: start; gap: 1.4rem;
  padding: clamp(1.8rem, 4vw, 3rem) var(--pad);
  background: linear-gradient(90deg, color-mix(in srgb, var(--paper) 70%, transparent), color-mix(in srgb, var(--paper) 96%, transparent) min(1.4rem, var(--pad)));   /* the pattern shows at the edge, never under the words */
  border-left: 2px solid var(--accent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  animation: sheet-in .35s cubic-bezier(.2,.7,.2,1);
}
.case-sheet[hidden] { display: none; }
.case-sheet-title { font: 500 .72rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.case-sheet-text { display: grid; gap: 1.4rem; }
@keyframes sheet-in { from { transform: translateX(100%); opacity: .4; } }

.case-head {
  display: grid;
  grid-template-columns: minmax(0, 12rem) minmax(0, 1fr);
  gap: clamp(1.5rem, 3vw, 3rem);
  padding: clamp(2.5rem, 6vw, 5rem) var(--pad) clamp(2rem, 4vw, 3rem);
}
.case-cat {
  font: 400 .66rem/1.6 var(--mono); letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted);
}
.case-cat [lang="zh-Hant"] { text-transform: none; letter-spacing: 0; }
.case-intro { display: grid; gap: 1.1rem; max-width: 64rem; }
.case-head h2 {
  max-width: 18ch;
  font-size: clamp(1.9rem, 4vw, 3.6rem);
  font-weight: 500; line-height: 1; letter-spacing: -.04em;
}
.case-scope {
  font: 400 .72rem/1.6 var(--mono); letter-spacing: .04em; color: var(--muted);
}
.case-intro .read-full { padding-top: .4rem; }

/* ---------- sequence --------------------------------------------- */
.case-body {
  display: grid; gap: clamp(2.2rem, 5vw, 5.5rem);
  padding: 0 var(--pad);
}
.seq img { background: var(--paper-2); }
/* scroll-driven wipe on entry — one direction per project; opening plate holds still */
@supports (animation-timeline: view()) {
  .case-body .seq:not(.seq--opening) img {
    animation: var(--wipe, seq-wipe-y) 1ms linear forwards;
    animation-timeline: view(inline);          /* the case scrolls sideways */
    animation-range: entry 0% entry 45%;
  }
  .case-body.wipe-x { --wipe: seq-wipe-x; }
  @keyframes seq-wipe-y { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }
  @keyframes seq-wipe-x { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
}

.seq--opening { margin-bottom: clamp(1rem, 3vw, 3rem); }
.seq--opening img { border: 1px solid var(--line-2); }

.seq--full { margin-inline: calc(var(--pad) * -1); }          /* full bleed */
.seq--wide { width: min(100%, 78rem); margin-inline: auto; }
.seq--square, .seq--tall { width: min(100%, 40rem); margin-inline: auto; }

.seq--pair {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--gap); align-items: start;
}
.pair-cell img { background: var(--paper-2); }

.seq--pause {
  display: grid; place-items: center;
  padding: clamp(1rem, 5vw, 4rem) 0;
}
.pause-rule { display: block; width: 3.5rem; height: 2px; background: var(--accent); }

/* ---------- close / next ----------------------------------------- */
.case-foot {
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--paper); color: var(--ink);
  margin-top: clamp(3rem, 8vw, 7rem);
  border-top: 1px solid var(--line);
}
.case-next, .case-return {
  display: flex; align-items: center; gap: .8rem;
  min-height: clamp(6rem, 12vw, 9rem);
  padding: 1.5rem var(--pad);
  text-align: left;
  transition: background-color var(--t), color var(--t);
}
.case-next { flex-wrap: wrap; position: relative; }
.case-next::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent);
}
.next-label {
  width: 100%;
  font: 500 .66rem/1 var(--mono); letter-spacing: .11em; text-transform: uppercase;
  color: var(--muted);
}
.next-name { font-size: clamp(1.1rem, 2.2vw, 1.8rem); font-weight: 600; letter-spacing: -.028em; }
.case-next i { font-style: normal; transition: transform var(--t); }
.case-next:hover i { transform: translateX(.3rem); }
.case-next:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }

.case-return {
  justify-content: flex-end;
  border-left: 1px solid var(--line);
  background: var(--ink); color: var(--paper);
  font: 500 .78rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase;
}
.case-return i { font-style: normal; transition: transform var(--t); }
.case-return:hover i { transform: translateY(-.25rem); }
.case-next[hidden] { display: none; }
.case-next[hidden] + .case-return { grid-column: 1 / -1; border-left: 0; }

/* =================================================================
   VIEW TRANSITION — index plate → case study opening image
   ================================================================= */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .4s; }
::view-transition-group(plate) {
  animation-duration: .62s;
  animation-timing-function: cubic-bezier(.2,.75,.15,1);
}
::view-transition-old(plate), ::view-transition-new(plate) {
  animation: none; mix-blend-mode: normal; object-fit: contain;
}
::view-transition-old(plate) { display: none; }

/* =================================================================
   HORIZONTAL CASE — the home page reads down; a project reads across.
   head panel → images in a row → next/close panel. Vertical wheel and
   arrow keys move it sideways (site.js); phones swipe with snap.
   ================================================================= */
.hero-more { margin-top: 1rem; }
.hero .name-frame .nf-inner { fill-opacity: .4; }

.case { overflow: hidden; }
.case-shell { height: 100%; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.case-track {
  display: flex; align-items: center; gap: clamp(1.5rem, 3vw, 3.5rem);
  min-height: 0; height: 100%;
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  padding: 0 var(--pad); scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--accent) 55%, transparent) transparent;
}
.case-track:focus-visible { outline: 2px solid var(--seal); outline-offset: -4px; }
.case-track > .case-head h2 { font-size: clamp(1.75rem, 2.6vw, 3.2rem); text-wrap: balance; }
.case-track > .case-head {
  flex: 0 0 min(30rem, 34vw); align-self: center;
  display: flex; flex-direction: column; gap: 1.1rem;
  padding: 1.6rem 1.4rem; max-height: calc(100% - 2rem); overflow-y: auto;
}
.case-track .case-intro .read-full { grid-template-columns: 1fr; }
.case-track > .case-body {
  flex: 0 0 auto; height: 100%;
  display: flex; align-items: center; gap: clamp(1.2rem, 2.4vw, 2.6rem); padding: 0;
}
.case-track .seq { flex: 0 0 auto; height: 78%; width: auto; margin: 0; }
.case-track .seq img { height: 100%; width: auto; max-width: none; }
.case-track .seq--full { height: 100%; margin: 0; }
.case-track .seq--opening { margin: 0; }
.case-track .hang > .seq--full { height: 62%; }
.case-track .seq--pair { display: flex; gap: var(--gap); height: 78%; }
.case-track .pair-cell { height: 100%; flex: 0 0 auto; }
.case-track .pair-cell img { height: 100%; width: auto; }
.case-track .seq--pause { width: 2.5rem; height: auto; padding: 0; }
.case-track .pause-rule { width: 2px; height: 3.5rem; }
.case-track > .case-foot {
  flex: 0 0 min(24rem, 70vw); align-self: center;
  display: flex; flex-direction: column; margin: 0; border: 0; background: none;
}
.case-track > .case-foot .case-return { border-left: 0; }
.case-track::after { content: ""; flex: 0 0 1px; }       /* end padding that flex scrollers otherwise drop */

/* the hung wall -------------------------------------------------------
   each piece hangs in its own bay; the bay is the full strip height and
   the piece takes a share of it, top, middle or bottom. Numbers sit in
   the free space beside the piece, like a show label. */
.case-track > .case-body { align-items: stretch; gap: clamp(1.6rem, 3.2vw, 3.6rem); }
.hang { position: relative; flex: 0 0 auto; height: 100%; display: flex; flex-direction: column; min-width: 0; }
.case-track .hang > .seq, .case-track .hang-cell > .seq { width: auto; flex: 0 0 auto; margin: 0; }
.hang--open { justify-content: center; }
.hang--open > .seq  { height: 80%; }
.hang--big  { justify-content: center; }
.hang--big  > .seq  { height: 82%; }
.hang--mid  { justify-content: center; }
.hang--mid  > .seq  { height: 62%; }
.hang--high { justify-content: flex-start; }
.hang--high::before, .hang--low::after, .hang--pair::before, .hang--pair::after { content: ""; flex: 0 0 3%; }   /* spacers: % of the bay's height (padding % would follow its width) */
.hang--high > .seq  { height: 54%; }
.hang--low  { justify-content: flex-end; }
.hang--low  > .seq  { height: 56%; }
.hang--pair { justify-content: flex-start; }
.hang--pair > .hang-cell:last-child { margin-top: auto; }       /* all the free height goes between the two, room for both labels */
.hang-cell  { position: relative; height: 40%; display: flex; }
.hang-cell > .seq { height: 100%; }
.hang--pair > .hang-cell:last-child { align-self: flex-end; margin-left: clamp(2rem, 6vw, 6rem); }
.hang--pair > .hang-cell:first-child { align-self: flex-start; }
.hang-n {
  position: absolute; left: 0; z-index: 1; white-space: nowrap; pointer-events: none;
  font: 500 .66rem/1 var(--mono); letter-spacing: .12em; color: color-mix(in srgb, var(--ink) 55%, var(--muted));
}
.hang-n i { font-style: normal; opacity: .55; }
.hang--big > .hang-n, .hang--mid > .hang-n, .hang--open > .hang-n { bottom: calc(9% - 1.2rem); }
.hang--big > .hang-n { bottom: calc(9% - 1.4rem); }
.hang--mid > .hang-n { bottom: calc(19% - 1.4rem); }
.hang--open > .hang-n { bottom: calc(10% - 1.4rem); }
.hang--high > .hang-n { top: calc(3% + 54% + .7rem); }
.hang--low > .hang-n  { top: calc(41% - 1.6rem); }
.hang-cell > .hang-n  { top: auto; bottom: -1.3rem; }
.hang--pair > .hang-cell:first-child > .hang-n { bottom: -1.3rem; }
.hang--pair > .hang-cell:last-child > .hang-n { top: -1.3rem; bottom: auto; }

/* puzzles: same-shaped detail/product shots share one panel -------- */
.case-track .seq--mosaic { display: grid; gap: 8px; width: auto; flex: 0 0 auto; }
.seq--m2 { grid-template-columns: 1fr 1fr; }
.seq--m3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.seq--m3 > .m-cell:first-child { grid-row: span 2; }
.seq--m4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.seq--m2v { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
.m-cell {
  position: relative; display: block; min-width: 0; min-height: 0;
  padding: 0; border: 0; overflow: clip; cursor: zoom-in; background: var(--paper-2);
}
.case-track .m-cell img { width: 100%; height: 100%; max-width: none; object-fit: cover; }
.m-cell::after {
  content: "+"; position: absolute; right: .5rem; bottom: .5rem;
  width: 1.6rem; height: 1.6rem; display: grid; place-items: center;
  background: var(--ink); color: var(--paper); font: 500 .9rem/1 var(--mono);
  opacity: 0; transform: scale(.85); transition: opacity .25s ease, transform .25s ease;
}
.m-cell:hover::after, .m-cell:focus-visible::after { opacity: 1; transform: none; }
.m-cell:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; }
@media (max-width: 620px) {
  .case-track .seq--mosaic { height: auto; width: 86vw; scroll-snap-align: center; gap: 5px; }
  .case-track .m-cell img { height: 100%; max-height: none; }
  .m-cell::after { opacity: .85; transform: none; }       /* touch: show the hint */
}
/* swapping to the previous / next project: the strip dips and comes back */
.case-track.is-swapping { opacity: 0; transition: none; }
.case-track { transition: opacity .32s ease; }
/* zoom */
.case-zoom {
  position: absolute; inset: 0; z-index: 30;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem;
  padding: 3.5rem var(--pad) 2rem;
  background: color-mix(in srgb, var(--ink-2) 94%, transparent); cursor: zoom-out;
  animation: zoom-in .25s ease;
}
.case-zoom[hidden] { display: none; }
.case-zoom img { grid-column: 2; justify-self: center; max-width: 100%; max-height: calc(100dvh - 6rem); width: auto; height: auto; object-fit: contain; }
.case-zoom-close {
  position: absolute; top: 1rem; right: var(--pad); color: var(--paper);
  font: 500 .72rem/1 var(--mono); letter-spacing: .09em; text-transform: uppercase;
}
.case-zoom-close [lang="zh-Hant"] { text-transform: none; margin-left: .35em; opacity: .72; }
.case-zoom-nav { color: var(--paper); font: 400 1.4rem/1 var(--mono); padding: .8rem; opacity: .7; cursor: pointer; }
.case-zoom-nav:hover { opacity: 1; }
.case-zoom-nav.prev { grid-column: 1; } .case-zoom-nav.next { grid-column: 3; }
@keyframes zoom-in { from { opacity: 0; } to { opacity: 1; } }

/* layers inside a project ------------------------------------------ */
/* 1. parallax: each image drifts inside its frame as the strip passes; the opening plate holds still */
.case-track .seq:not(.seq--opening), .case-track .pair-cell { overflow: clip; }   /* clip, not hidden: hidden would make each frame its own scroller and freeze the view() timelines */
@supports (animation-timeline: view()) {
  .case-body .seq:not(.seq--opening) img {
    animation: var(--wipe, seq-wipe-y) 1ms linear forwards, seq-drift 1ms linear both;
    animation-timeline: view(inline), view(inline);
    animation-range: entry 0% entry 45%, cover 0% cover 100%;
  }
  @keyframes seq-drift { from { transform: translateX(5%) scale(1.1); } to { transform: translateX(-5%) scale(1.1); } }
}
@supports (animation-timeline: view()) {
  @media (max-width: 620px) {
    .case-body .seq:not(.seq--opening) img {
      animation: var(--wipe, seq-wipe-y) 1ms linear forwards, seq-drift-y 1ms linear both;
      animation-timeline: view(block), view(block);
      animation-range: entry 0% entry 55%, cover 0% cover 100%;
    }
    .case-body > .hang:not(.hang--open) {
      animation: hang-rise 1ms linear both; animation-timeline: view(block); animation-range: entry 0% entry 70%;
    }
    .case-body > .hang--high { --hx: -6%; } .case-body > .hang--low { --hx: 6%; }
    @keyframes hang-rise { from { opacity: .25; transform: translate3d(var(--hx, 0), 2.4rem, 0) scale(.94); } to { opacity: 1; transform: none; } }
    @keyframes seq-drift-y { from { transform: translateY(5%) scale(1.1); } to { transform: translateY(-5%) scale(1.1); } }
  }
}
/* 2. ghost title: the project's name, huge and outlined, sliding slower than the images */
.case-ghost {
  position: absolute; left: 0; bottom: 4vh; z-index: 0; pointer-events: none;
  font: 600 clamp(9rem, 34vh, 22rem)/.8 var(--sans); letter-spacing: -.05em; white-space: nowrap;
  color: transparent; -webkit-text-stroke: 1.5px var(--accent);
  opacity: .16; will-change: transform;
}
/* 3. progress: a rule under the case bar, in the project's colour */
.case-bar { position: sticky; }
.case-progress {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left; will-change: transform;
}

@media (max-width: 620px) {
  .case-bar { grid-template-columns: auto minmax(0, 1fr) auto auto auto; gap: .5rem; padding-inline: .6rem var(--pad); }
  .case-bar-mark { width: 1rem; }
  .case-step span { display: none; }
  .case-step { min-width: 44px; padding: 0; justify-content: center; }
  .case-step i { font-size: 1.6rem; }
  .case-close > span { display: none; }                 /* × alone; the button's label still says Close 關閉 */
  .case-close { min-width: 44px; min-height: 44px; justify-content: center; }
  .case-close i { font-size: 1.5rem; }
  .case-steps { gap: 0; }
  .case-sheet {
    left: 0; right: 0; top: auto; width: auto; max-height: 72dvh;
    border-left: 0; border-top: 2px solid var(--accent);
    background: linear-gradient(180deg, color-mix(in srgb, var(--paper) 70%, transparent), color-mix(in srgb, var(--paper) 96%, transparent) 1.3rem);
    animation-name: sheet-up;
  }
  @keyframes sheet-up { from { transform: translateY(100%); opacity: .4; } }
  /* phones: the wall reads downwards — pieces hang left, right, full; pairs side by side, staggered */
  .case-track { flex-direction: column; align-items: stretch; overflow-x: hidden; overflow-y: auto;
    overscroll-behavior-y: contain; gap: 2.4rem; padding: 1.4rem 5vw 2.5rem; scroll-snap-type: none; }
  .case-track > .case-head { flex: 0 0 auto; max-height: none; overflow: visible; padding: 1.3rem 1.1rem; }
  .case-track > .case-body { flex-direction: column; align-items: stretch; height: auto; gap: 2.6rem; }
  .case-track > .case-foot { flex: 0 0 auto; }
  .case-track::after { flex-basis: 1px; }
  .hang { height: auto; padding: 0 !important; }
  .hang::before, .hang::after { display: none; }
  .case-track .hang > .seq, .case-track .hang-cell > .seq { height: auto !important; width: 100%; }
  .case-track .seq img { width: 100%; height: auto; max-height: none; }
  .case-track .seq--mosaic { height: auto; width: 100%; gap: 5px; }
  .hang--high { width: 82%; align-self: flex-start; }
  .hang--low  { width: 82%; align-self: flex-end; }
  .hang--pair { flex-direction: row; align-items: flex-start; gap: 4vw; }
  .hang-cell  { width: 48%; height: auto; flex-direction: column; }
  .hang--pair > .hang-cell:last-child { margin: 3.2rem 0 0 !important; align-self: auto; }
  .hang-n, .hang--big > .hang-n, .hang--mid > .hang-n, .hang--open > .hang-n, .hang--high > .hang-n, .hang--low > .hang-n,
  .hang-cell > .hang-n, .hang--pair > .hang-cell:first-child > .hang-n, .hang--pair > .hang-cell:last-child > .hang-n {
    position: static; order: 2; margin-top: .55rem; }
  .hang--low > .hang-n { text-align: right; }
}

/* =================================================================
   ERROR STATE
   ================================================================= */
.image-error {
  position: relative;
  background: repeating-linear-gradient(135deg, #DEDBD2, #DEDBD2 8px, #E8E5DC 8px, #E8E5DC 16px);
  min-height: 8rem;
}
.image-error img { visibility: hidden; }
.image-error::after {
  content: "Image unavailable 圖片無法載入";
  position: absolute; inset: 0; display: grid; place-items: center;
  font: 500 .66rem/1 var(--mono); letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted);
}

/* =================================================================
   REVEALS
   ================================================================= */
.reveal { opacity: 0; transform: translateY(.9rem); }
html.no-js .reveal { opacity: 1; transform: none; }

/* plates: fallback path — IntersectionObserver adds .is-visible */
.rise { opacity: 0; transform: translateY(12px); }
.rise.is-visible {
  opacity: 1; transform: none;
  transition: opacity .6s ease, transform .6s cubic-bezier(.2,.75,.15,1);
}
/* plates: scroll-driven path — no JS, compositor only */
@supports (animation-timeline: view()) {
  .rise, .rise.is-visible {
    opacity: 1; transform: none; transition: none;
    /* forwards, not both: before a plate has entered it keeps its base
       (visible) style, so a full-page capture never finds it hidden */
    animation: plate-rise 1ms linear forwards;
    animation-timeline: view();
    animation-range: entry 0% entry 55%;
  }
  @keyframes plate-rise {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
  }
}
.reveal.is-visible {
  opacity: 1; transform: none;
  transition: opacity .7s ease, transform .7s cubic-bezier(.2,.75,.15,1);
}

/* =================================================================
   RESPONSIVE
   ================================================================= */
@media (max-width: 1180px) {
  .services { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .services > li:nth-child(3) { border-left: 0; padding-left: 0; }
  .services > li:nth-child(3), .services > li:nth-child(4) { border-top: 1px solid var(--line); padding-top: 1.2rem; }
}

@media (max-width: 980px) {
  html { scroll-padding-top: 6.5rem; }   /* the two-row header, when it comes back on scroll-up */
  .header-inner {
    grid-template-columns: 1fr;
    row-gap: 0; padding-bottom: 0;
  }
  .chapters {
    justify-content: flex-start;
    gap: 1.4rem;
    padding: .1rem 0 .55rem;
    margin-top: .35rem;
    border-top: 1px solid var(--line-2);
    overflow-x: auto; scrollbar-width: none;
  }
  .chapters::-webkit-scrollbar { display: none; }
  .chapters a { padding-top: .55rem; white-space: nowrap; }

  .hero { grid-template-columns: 1fr; align-items: start; }
  .hero-plate { width: min(82%, 28rem); margin-left: auto; justify-self: auto; }
  .hero-frame { height: auto; width: 100%; }

  .case-head, .read-full { grid-template-columns: 1fr; }
  .contact { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
  :root { --bar: 3.1rem; }
  h1 { font-size: clamp(2.1rem, 10vw, 2.9rem); }
  .chapters { flex-wrap: wrap; gap: 0 1.1rem; overflow: visible; }
  /* fingers, not pointers: every tappable line gets at least 24px of height */
  .chapters a { font-size: .7rem; letter-spacing: .03em; padding-top: .55rem; padding-bottom: .35rem; }
  .chapters { padding-bottom: .35rem; }
  .chip { padding-block: .55rem; }
  .text-link { padding-top: .5rem; padding-bottom: .5rem; }
  .case-info { min-height: 44px; }
  .read-toggle { padding-block: .6rem; }
  .hero-plate { width: 100%; }
  .hero { padding-top: 2.2rem; }   /* room for the name frame's top line */

  .chapter-head { align-items: flex-start; flex-direction: column; }
  .index { grid-template-columns: 1fr; gap: 2.2rem; }

  .services { grid-template-columns: 1fr; }
  .services > li, .services > li + li {
    padding: 1.2rem 0 1.4rem; border-left: 0; border-top: 1px solid var(--line);
  }
  .services > li:first-child { border-top: 0; padding-top: .2rem; }
  .contact { grid-template-columns: 1fr; }

  .seq--pair { grid-template-columns: 1fr; }
  .case-foot { grid-template-columns: 1fr; }
  .case-return { border-left: 0; border-top: 1px solid var(--line); justify-content: flex-start; }

  body > footer { grid-template-columns: 1fr auto; min-height: 8rem; }
  .colophon { display: none; }
}

/* =================================================================
   REDUCED MOTION
   ================================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
  .reveal, .rise, .rise.is-visible { opacity: 1; transform: none; animation: none; }
  .wx { transition: none; transform: none !important; will-change: auto; }
  body { transition: none; }
  .dim, .dim.is-on, .case-dim { display: none; }
  .plate-frame, .plate-foot { opacity: 1 !important; transform: none !important; transition: none; }
  .hero-frame img.is-on { animation: none; }
  .hero-frame img.was-on { opacity: 0; }
  .case-body .seq img { animation: none !important; clip-path: none; transform: none !important; }
  .case-ghost { display: none; }
  .contact-call .ct-line { animation: none !important; transform: none !important; }
  .case-body > .hang { animation: none !important; opacity: 1 !important; transform: none !important; }
  .case-zoom, .case-sheet { animation: none; }
  .site-header { transition: none; }
  .fx-canvas { animation: none; display: none; }
  .case-track { transition: none; }
  .fx-snap { scroll-behavior: auto; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .hero-tick { display: none; }
  .plate-peek { display: none; }
  .chapter-progress { transition: none; }
  .plate:hover .plate-frame img { transform: none; }
}

/* =================================================================
   PRINT
   ================================================================= */
@media print {
  .site-header, .chips, .plate-cue, .case-foot, .case-bar, .read-toggle, .weather { display: none; }
  .case-sheet[hidden] { display: grid; }
  .plate-frame, .plate-foot { opacity: 1 !important; transform: none !important; }
  .read-full[hidden] { display: grid; }
  .reveal, .rise { opacity: 1; transform: none; animation: none; }
  body { background: #fff; }
  .chapter--studio, body > footer { background: #fff; color: #000; }
}
