#works {
  --work-lift-distance: clamp(12px, 1.4vw, 19px);
}

/* Move the artwork inside the stationary project hit area. */
#gallery .project-card .card-cover,
#works .directions-console .direction-spatial .direction-card > div {
  transform: translateY(var(--work-artwork-y, 0px));
  transition: transform 150ms cubic-bezier(.16, 1, .3, 1);
  pointer-events: none;
}

#works .directions-console .direction-spatial .direction-card {
  overflow: visible;
  border-color: transparent;
}

#works .directions-console .direction-spatial .direction-card > div {
  border-radius: inherit;
  outline: 1px solid #4a4a50;
}

#gallery .project-card:focus-visible:where(:not(.dragging *)),
#works .direction-spatial:not(.is-dragging) .direction-card:focus-visible {
  --work-artwork-y: calc(-1 * var(--work-lift-distance));
}

/* Use consistent frames within each format on the wall. */
#gallery {
  --work-frame: 16 / 10;
  --work-gap: clamp(12px, 1.55vw, 24px);
  --work-row-gap: clamp(20px, 2.35vw, 36px);
}

#gallery[data-view="wall"] {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  gap: var(--work-row-gap) var(--work-gap);
  padding-top: 8px;
}

#gallery[data-view="wall"][data-stacked-wall] {
  grid-auto-rows: 8px;
  row-gap: 0;
}

#gallery[data-view="wall"][data-stacked-wall] .project-card {
  grid-row-end: span var(--work-row-span, 1);
  margin-bottom: var(--work-row-gap);
}

#gallery[data-view="wall"] .project-card {
  --work-frame: 16 / 9;
}

#gallery[data-view="wall"] .project-card[data-cover-shape="portrait"] {
  --work-frame: 2 / 3;
}

#gallery[data-view="wall"].single {
  max-width: none;
}

#gallery .project-card {
  min-width: 0;
  margin: 0;
  text-align: left;
}

#gallery .project-card .card-cover {
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: var(--work-frame);
  overflow: hidden;
  border-radius: 8px;
  background: #111113;
  will-change: auto;
}

#gallery .project-card .card-cover::after {
  position: absolute;
  inset: 0;
  border: 1px solid var(--work-hover-color, transparent);
  border-radius: inherit;
  pointer-events: none;
  transition: border-color 160ms ease;
  content: "";
}

#gallery .project-card .card-cover img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  object-position: var(--work-subject, center);
  scale: var(--work-edge-crop, 1);
  transform: none;
  filter: none;
}

#gallery[data-view="wall"] [data-cover-shape="portrait"] .card-cover img {
  object-position: var(--work-portrait-subject, center);
}

#gallery .project-card .card-open {
  opacity: var(--work-open-opacity, 0);
  transform: none;
  border-color: var(--work-hover-color, #ffffff40);
  background: var(--work-hover-color, #111113d9);
  color: var(--work-arrow-ink, #fafafa);
  transition: opacity 150ms ease, background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

#gallery .project-card .card-open svg {
  transform: translate(var(--work-arrow-x, -3px), var(--work-arrow-y, 3px));
  transition: transform 240ms var(--ease);
}

#gallery .project-card:is(:focus-visible, :active):where(:not(.dragging *)) {
  --work-hover-color: var(--accent);
  --work-open-opacity: 1;
  --work-arrow-ink: #111113;
  --work-arrow-x: 1px;
  --work-arrow-y: -1px;
}

@media (hover: hover) and (pointer: fine) {
  #gallery .project-card:hover:where(:not(.dragging *)) {
    --work-hover-color: var(--accent);
    --work-open-opacity: 1;
    --work-arrow-ink: #111113;
    --work-artwork-y: calc(-1 * var(--work-lift-distance));
    --work-arrow-x: 1px;
    --work-arrow-y: -1px;
  }

  #works .direction-spatial:not(.is-dragging) .direction-card:hover {
    --work-artwork-y: calc(-1 * var(--work-lift-distance));
  }
}

#gallery .card-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin: 10px 0 0;
  color: #e6e6e8;
  font-size: clamp(12px, .92vw, 14px);
  font-weight: 500;
  line-height: 1.45;
}

#gallery .card-meta {
  margin-top: 3px;
  color: #9b9ba3;
}

#gallery .workflow-card-flow {
  color: #9b9ba3;
}

#gallery .focus-track {
  --focus-card-width: min(520px, 58vw, 72cqw);
  --work-open-opacity: 1;
  container-type: inline-size;
  gap: var(--work-gap);
  padding-top: var(--work-lift-distance);
  padding-bottom: 14px;
}

#gallery .focus-track::after {
  content: "";
  flex: 0 0 max(0px, calc(100% - var(--focus-card-width) - var(--work-gap)));
}

#gallery .focus-track .project-card {
  flex: 0 0 var(--focus-card-width);
  width: var(--focus-card-width);
  padding: 0;
  opacity: .82;
}

#gallery .focus-track .project-card:is(.in-focus, :hover, :focus-visible) {
  opacity: 1;
}

#gallery .focus-track .project-card::before {
  content: none;
}

#gallery .focus-track .card-title {
  font-size: clamp(14px, 1.1vw, 17px);
}

#gallery .focus-track .card-open {
  display: flex;
  width: 34px;
  height: 34px;
  right: 10px;
  bottom: 10px;
  border-radius: 50%;
}

#gallery .focus-track .card-open svg {
  width: 16px;
  height: 16px;
}

/* Reframe around the subject, including assets that carry a narrow edge in the source. */
#gallery [data-project-id="gittamy"],
#projectDialog[data-project-id="gittamy"] {
  --work-subject: 50% 58%;
  --work-edge-crop: 1.07;
}

#gallery [data-project-id="gittamy"] {
  --work-portrait-subject: center 42%;
}

#gallery [data-project-id="timeshape"] {
  --work-subject: 50% 55%;
}

#gallery [data-project-id="brightgames"] {
  --work-subject: center 53%;
}

#gallery [data-project-id="brightmoon"] {
  --work-subject: center 43%;
}

#gallery [data-project-id="aihistory"] {
  --work-subject: center 19%;
  --work-edge-crop: 1.045;
}

#gallery [data-project-id="newyear"] {
  --work-subject: center 57%;
  --work-edge-crop: 1.045;
}

#gallery [data-project-id="illustration"],
#projectDialog[data-project-id="illustration"] {
  --work-subject: center 29%;
  --work-edge-crop: 1.06;
}

#gallery [data-project-id="illustration"] {
  --work-portrait-subject: center 36%;
}

#gallery [data-project-id="aipeople"],
#projectDialog[data-project-id="aipeople"] {
  --work-edge-crop: 1.04;
}

#projectDialog:is([data-project-id="gittamy"], [data-project-id="illustration"], [data-project-id="aipeople"]) .editorial-tile:first-child img {
  object-fit: cover;
  object-position: var(--work-subject, center);
  scale: var(--work-edge-crop, 1);
}

#gallery [data-project-id="food"] {
  --work-subject: center 53%;
  --work-portrait-subject: 55% center;
}

#gallery [data-project-id="conference-2026"] {
  --work-subject: 72% center;
}

#gallery [data-project-id="type3d"] .card-cover {
  background: #000;
}

#gallery [data-project-id="type3d"] .card-cover img {
  object-fit: contain;
}

@media (max-width: 1240px) {
  #gallery[data-view="wall"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  #gallery[data-view="wall"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #gallery .focus-track {
    --focus-card-width: min(400px, 76cqw);
  }
}

@media (prefers-reduced-motion: reduce) {
  #gallery .project-card .card-cover,
  #works .directions-console .direction-spatial .direction-card > div,
  #gallery .project-card .card-cover img,
  #gallery .project-card .card-open svg {
    transform: none;
    transition: none;
  }

  #gallery .focus-track { padding-top: 0; }
}


#filters .filter[data-preview], #filters .filter.selected { color: #fff; }
#filters .filter[data-preview] { box-shadow: inset 0 -1px #ef594e; }
@media (prefers-reduced-motion: no-preference) {
  #filters .filter.selected span { animation: filter-settle 220ms ease-out; }
  @keyframes filter-settle { from { transform: translateY(3px); opacity: .5; } }
}

#works .filter-options #filters {
  display:flex; flex-flow:row nowrap; align-items:center; gap:clamp(14px,1.4vw,26px);
  overflow-x:auto; scrollbar-width:thin; scrollbar-color:#454545 transparent;
}
#works #filters .filter {flex:0 0 auto; white-space:nowrap; min-height:40px;}
.direction-cover-caption {display:flex;align-items:baseline;justify-content:center;flex-wrap:wrap;gap:3px 12px;padding:12px 8px 0;text-align:center;}
.direction-cover-caption strong {color:#eee;font-size:clamp(14px,1.3vw,20px);font-weight:550;}
.direction-cover-caption span {color:#aaa;font-size:clamp(11px,.9vw,14px);}

#works .direction-spatial [data-category="电商设计"] img { object-position: 50% 57%; }
#works .direction-spatial [data-category="插画"] img {
  object-view-box: inset(0 0 0 14%);
  object-position: 50% 35%;
}

.direction-stage-frame {position:relative;min-width:0;}
.direction-stage-frame .direction-edge {
  --cue-shift:4px;position:absolute;z-index:5;top:50%;right:clamp(6px,1vw,18px);translate:0 -50%;
  display:grid;place-items:center;width:44px;height:44px;border-radius:50%;border:1px solid #ffffff70;
  background:#111114eb;color:#fff;cursor:pointer;
}
.direction-stage-frame .direction-edge-prev {--cue-shift:-4px;right:auto;left:clamp(6px,1vw,18px);}
.direction-edge svg {width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.6;}
.direction-edge-prev svg {rotate:180deg;}
.direction-stage-frame .direction-edge:is(:hover,:focus-visible) {border-color:#ff7869;color:#ff978a;}
@media(prefers-reduced-motion:no-preference){
 .show-direction-cue .direction-edge svg {animation:direction-cue 850ms ease-in-out 1;}
 @keyframes direction-cue {50%{translate:var(--cue-shift) 0;}}
}

#works .direction-stage.is-expanded {position:fixed;inset:0;z-index:9999;background:#090909;padding:20px;overflow:auto;display:block;}
#works .direction-stage.is-expanded .direction-grid {height:min(66svh,720px);}
#works .direction-full {background:#171212;color:#eee;border:1px solid #57413c;padding:8px 12px;cursor:pointer;white-space:nowrap}

#works .view-controls {
 display:inline-grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:3px;
 width:max-content;max-width:100%;flex:0 0 auto;padding:3px;
 background:#101012;border:1px solid #2c2c30;border-radius:7px;
}
#works .view-controls .view-button {
 position:relative;width:auto;min-width:0;height:auto;min-height:38px;padding:8px 16px;
 border:0;border-radius:4px;background:transparent;color:#a8a8ae;
 font-size:13px;line-height:1.45;box-shadow:none;
}
#works .view-controls .view-button::before {content:none}
#works .view-controls .view-button:hover {color:#fff}
#works .view-controls .view-button[aria-pressed="true"] {background:#28282b;color:#f7f5f1;}
#works .view-controls .view-button[aria-pressed="true"]::after {
 content:"";position:absolute;inset:auto 0 3px;margin:auto;width:18px;height:2px;background:#ff695a;border-radius:1px;
}
#works .view-controls .view-button:focus-visible {outline:2px solid #ff998e;outline-offset:-2px}
@media(max-width:700px){
 #works .view-controls .view-button {min-height:44px;}
}

#works .direction-stage-frame {container-type:inline-size}
#works .direction-grid.direction-spatial {
  --direction-step:38cqw;
  height:32cqw;
  background:transparent;
  border:0;
  perspective:none;
}
#works .directions-console .direction-spatial .direction-card {
  width:50cqw;
  border:0;
  border-radius:2px;
  transform:translate(calc(-50% + var(--direction-slot) * var(--direction-step) + var(--direction-drag,0px)), -50%) scale(var(--direction-scale));
}
#works .directions-console .direction-spatial .direction-card > div {
  transform:none;
  outline:none;
}
#works .direction-spatial .direction-card[data-depth="1"] {
  --direction-scale:.44;
  --direction-brightness:.80;
}
#works .direction-spatial .direction-card[data-depth="2"] {
  visibility:hidden;
  opacity:0;
  pointer-events:none;
}
#works .direction-card:focus-visible {outline:2px solid #ffad96;outline-offset:3px}
#works .direction-cover-caption {
  margin-inline:25%;
  padding:0 0 16px;
  justify-content:flex-start;
  text-align:left;
  column-gap:14px;
}
#works .direction-cover-caption strong {font-size:clamp(16px,1.35vw,24px);line-height:1.4}
#works .direction-cover-caption span {color:#aaa5a3;font-size:clamp(12px,.9vw,16px)}
@media(max-width:700px) {
  #works .direction-grid.direction-spatial {--direction-step:68cqw;height:62cqw}
  #works .directions-console .direction-spatial .direction-card {width:84cqw;aspect-ratio:3 / 2}
  #works .direction-spatial .direction-card[data-depth="1"] {--direction-scale:.55}
  #works .direction-cover-caption {margin-inline:8%;display:grid;gap:2px;padding-bottom:16px}
}

/* Five frontal previews with a clear active work. */
#works .direction-grid.direction-spatial {--direction-step:21cqw;height:22cqw}
#works .directions-console .direction-spatial .direction-card {width:28cqw}
#works .direction-spatial .direction-card[data-depth="1"] {--direction-scale:.5;--direction-brightness:.84}
#works .direction-spatial .direction-card[data-depth="2"] {visibility:visible;opacity:1;pointer-events:auto;--direction-scale:.5;--direction-brightness:.72}
#works .direction-cover-caption {margin-inline:36%}
@media(max-width:700px){
 #works .direction-grid.direction-spatial {--direction-step:21cqw;height:35cqw}
 #works .directions-console .direction-spatial .direction-card {width:30cqw;aspect-ratio:3 / 2}
 #works .direction-spatial .direction-card[data-depth="1"],#works .direction-spatial .direction-card[data-depth="2"] {--direction-scale:.65}
 #works .direction-cover-caption {margin-inline:0;justify-content:center;text-align:center}
}

/* Keep five previews visible while giving the active work more presence. */
#works .direction-grid.direction-spatial {--direction-step:20.5cqw;height:27cqw}
#works .directions-console .direction-spatial .direction-card {width:36cqw}
#works .direction-spatial .direction-card[data-depth="1"],#works .direction-spatial .direction-card[data-depth="2"] {--direction-scale:.55}
#works .direction-cover-caption {margin-inline:32%}
@media(max-width:700px){
 #works .direction-grid.direction-spatial {--direction-step:20.5cqw;height:40cqw}
 #works .directions-console .direction-spatial .direction-card {width:40cqw}
 #works .direction-spatial .direction-card[data-depth="1"],#works .direction-spatial .direction-card[data-depth="2"] {--direction-scale:.55}
 #works .direction-cover-caption {margin-inline:0}
}

#works .direction-grid.direction-spatial {height:32cqw}
#works .directions-console .direction-spatial .direction-card {width:44cqw}
#works .direction-spatial .direction-card[data-depth="1"],#works .direction-spatial .direction-card[data-depth="2"] {--direction-scale:.43}
#works .direction-cover-caption {margin-inline:28%}
@media(max-width:700px){
 #works .direction-grid.direction-spatial {height:47cqw}
 #works .directions-console .direction-spatial .direction-card {width:50cqw}
 #works .direction-spatial .direction-card[data-depth="1"],#works .direction-spatial .direction-card[data-depth="2"] {--direction-scale:.45}
 #works .direction-cover-caption {margin-inline:0}
}

#works .direction-stage-frame .direction-edge {width:clamp(40px,4vw,58px);height:clamp(40px,4vw,58px);background:rgba(12,12,13,.92);border:1px solid #ffffff75}
#works .direction-stage-frame .direction-edge-prev {left:clamp(6px,1vw,16px);right:auto}
#works .direction-stage-frame .direction-edge-next {right:clamp(6px,1vw,16px)}
#works .direction-stage-frame .direction-edge:focus-visible {outline:2px solid #ff998e;outline-offset:2px}
#works .direction-stage-panel .direction-controls {min-width:56px;justify-content:center}
@media(max-width:700px){#works .direction-stage-frame .direction-edge {width:38px;height:38px;top:50%;bottom:auto;translate:0 -50%}}

#works .direction-stage-frame #directionPrev svg {transform:none;rotate:180deg}
