.works-body { --works-gap: 21.6px; }
.works-skip { position: fixed; left: 16px; top: 8px; z-index: 40; padding: 8px 16px; border-radius: 20px; background: var(--pill); transform: translateY(-160%); }
.works-skip:focus { transform: none; }
.works-filters { z-index: 21; }
.works-page { padding-top: 24px; }
.works-page:focus { outline: none; }
.works-grid { position: relative; width: 100%; }
.work-slot { position: absolute; top: 0; left: 0; }
.work-slot[hidden] { display: none; }
.work-card { position: relative; display: block; width: 100%; height: 100%; overflow: hidden; border-radius: 24px; background: #f0f0f0; text-align: left; isolation: isolate; transition: transform .65s var(--spring); }
.work-card:focus-visible { outline-offset: 5px; }
.work-card > img, .work-card > video { width: 100%; height: 100%; object-fit: cover; }
.work-title { position: absolute; top: 12px; left: 12px; max-width: calc(100% - 24px); padding: 6px 9px; border-radius: 6px; background: var(--bg); color: var(--ink); font: 400 13px/1.3 var(--sans); opacity: 0; transform: translateY(-5px); transition: opacity .18s cubic-bezier(.22,.61,.36,1), transform .25s cubic-bezier(.22,.61,.36,1); pointer-events: none; }
.work-card:focus-visible .work-title { opacity: 1; transform: none; }
.work-markers { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 4px; pointer-events: none; }
.work-marker { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: rgba(255,255,255,.2); -webkit-backdrop-filter: blur(13px); backdrop-filter: blur(13px); color: #fff; font: 600 16px/1 var(--sans); }
.works-footer { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; padding: 112px 32px 24px; color: var(--muted); font: 400 12px/1.5 var(--sans); }
.works-footer nav { display: flex; gap: 20px; }
.works-footer a:hover { text-decoration: underline; text-underline-offset: 3px; }
.works-fallback { max-width: 50ch; padding: 48px 0; color: var(--muted); }

.work-detail { position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; height: 100svh; max-height: none; margin: 0; padding: 32px 32px 20px; border: 0; background: var(--bg); color: var(--ink); overflow: hidden; overscroll-behavior: contain; }
.work-detail::backdrop { background: var(--bg); }
.detail-layout { display: grid; grid-template-columns: minmax(0,1fr) 320px; grid-template-rows: minmax(0,1fr) auto; column-gap: 40px; row-gap: 24px; height: 100%; }
.detail-stage { grid-area: 1 / 1; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; padding: 0 24px; }
.detail-media { --media-height: min(70svh, calc(100svh - 190px)); display: block; width: min(100%, calc(var(--media-height) * var(--ratio))); max-height: var(--media-height); height: auto; aspect-ratio: var(--ratio); object-fit: contain; border-radius: 24px; background: var(--card); }
.detail-info { grid-area: 1 / 2; min-height: 0; padding-top: 40px; padding-right: 2px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.detail-info h2 { font: 500 20px/1.25 var(--sans); letter-spacing: -.025em; }
.detail-year, .detail-place { color: var(--muted); font: 400 14px/1.45 var(--sans); }
.detail-year { margin-top: 5px; }
.detail-place { margin-top: 3px; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.detail-section { margin-top: 28px; }
.detail-section h3 { margin-bottom: 9px; font: 500 16px/1.4 var(--sans); }
.detail-description { color: var(--muted); font: 400 16px/1.4 var(--sans); white-space: pre-line; }
.detail-link { display: inline-block; margin-top: 12px; font: 400 14px/1.45 var(--sans); overflow-wrap: anywhere; }
.detail-link[hidden] { display: none; }
.detail-credits { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.1fr); gap: 7px 16px; padding-bottom: 16px; font: 400 14px/1.4 var(--sans); }
.detail-credits dt { color: var(--muted); }
.detail-credits dd { text-align: right; overflow-wrap: anywhere; }
.round-control { display: inline-grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; position: relative; isolation: isolate; color: var(--muted); }
.round-control::before { content: ""; position: absolute; inset: 6px; z-index: -1; border-radius: 50%; background: var(--card); transition: background-color .16s; }
.round-control:active::before { background: var(--pill); }
.detail-close { position: absolute; top: 12px; right: 16px; z-index: 2; }
.detail-media-nav { grid-area: 2 / 1; min-width: 0; }
.detail-media-label { text-align: center; color: var(--muted); font: 400 14px/1.4 var(--sans); }
.detail-ruler { margin-top: 16px; height: 24px; }
.detail-thumbnails { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 60px; padding: 8px max(8px,calc(50% - 20px)); overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
.detail-thumbnails::-webkit-scrollbar { display: none; }
.detail-thumb { position: relative; flex: 0 0 40px; width: 40px; height: 40px; border-radius: 8px; background: var(--card); opacity: .55; transition: opacity .16s cubic-bezier(.22,.61,.36,1), transform .2s cubic-bezier(.22,.61,.36,1); }
.detail-thumb img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.detail-thumb[aria-pressed="true"] { opacity: 1; outline: 1px solid #b5b5b5; outline-offset: 3px; }
.detail-thumb:focus-visible { outline: 2px solid var(--ink); }
.detail-project-nav { grid-area: 2 / 2; display: flex; justify-content: flex-end; align-items: flex-end; gap: 1px; }

@media (hover: hover) and (pointer: fine) {
  .work-slot:hover, .work-slot:focus-within { z-index: 2; }
  .work-card:hover { transform: scale(1.02); }
  .work-card:hover .work-title { opacity: 1; transform: none; }
  .round-control:hover::before { background: var(--pill); }
  .detail-thumb:hover { opacity: 1; transform: translateY(-2px); }
}

@media (max-width: 799px) {
  .works-page { padding-top: 18px; }
  .works-footer { padding-top: 80px; flex-wrap: wrap; row-gap: 12px; }
  .work-detail { padding: 64px 24px 16px; overflow-y: auto; }
  .detail-layout { display: flex; flex-direction: column; gap: 0; height: auto; min-height: 100%; }
  .detail-stage { flex: none; width: 100%; padding: 0; min-height: 180px; }
  .detail-media { --media-height: 58svh; }
  .detail-info { flex: none; width: 100%; max-width: 520px; align-self: center; overflow: visible; padding: 30px 0 24px; }
  .detail-info h2 { font-size: 20px; }
  .detail-section { margin-top: 24px; }
  .detail-media-nav { position: sticky; bottom: -16px; flex: none; width: calc(100% + 48px); margin: auto -24px 0; padding: 14px 16px max(8px,env(safe-area-inset-bottom)); background: var(--bg); z-index: 1; }
  .detail-ruler { margin-top: 10px; }
  .detail-close { position: fixed; top: 12px; right: 12px; z-index: 5; }
  .detail-thumbnails { min-height: 60px; padding-inline: calc(50% - 22px); }
  .detail-thumb { flex-basis: 44px; width: 44px; height: 44px; }
  .detail-project-nav { flex: none; justify-content: flex-end; padding-top: 8px; }
}

@media (max-width: 480px) {
  .works-footer { padding-left: 16px; padding-right: 16px; }
  .work-detail { padding-left: 16px; padding-right: 16px; }
  .detail-media-nav { width: calc(100% + 32px); margin-left: -16px; margin-right: -16px; }
}

@media (prefers-reduced-motion: reduce) {
  .work-card, .work-title, .detail-thumb { transition: none; }
  .work-card:hover, .detail-thumb:hover { transform: none; }
}
