.works-viewer-open { overflow: hidden; }
[data-gallery-swipe] { touch-action: pan-y pinch-zoom; }

.works-viewer {
  width: min(1120px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  padding: clamp(8px, 2vw, 22px);
  margin: auto;
  border: 0;
  border-radius: 12px;
  background: #102b21;
  color: #fff;
}
.works-viewer::backdrop { background: rgb(8 22 17 / 88%); }
.works-viewer-toolbar { display: flex; justify-content: space-between; align-items: center; padding-bottom: 6px; }
.works-viewer-count { padding-inline: 8px; font-variant-numeric: tabular-nums; }
.works-viewer-stage { position: relative; display: grid; place-items: center; height: min(680px, calc(100dvh - 140px)); }
.works-viewer-stage img { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; }
.works-viewer-stage img.works-photo-rotated { position: absolute; width: min(680px, calc(100dvh - 140px)); height: min(680px, calc(100vw - 60px)); transform: rotate(90deg); }
.works-viewer button, .works-gallery button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid #fff8;
  border-radius: 50%;
  background: #102b21e8;
  color: #fff;
  font: 28px/1 system-ui;
  cursor: pointer;
}
.works-viewer button[hidden], .works-gallery button[hidden] { display: none; }
.works-viewer-prev, .works-viewer-next { position: absolute; z-index: 1; }
.works-viewer-prev { left: 4px; }
.works-viewer-next { right: 4px; }

.works-reading { color: #193e2c; padding-block: 35px 52px; }
.works-reading h2 { font: 650 clamp(25px, 4vw, 36px)/1.2 var(--display, system-ui); margin: 0 0 14px; }
.works-reading ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 225px), 1fr)); gap: 12px; list-style: none; padding: 0; margin: 0; }
.works-reading a { display: block; height: 100%; padding: 15px 18px; background: #edf3e9; color: #193e2c; text-decoration: underline; text-underline-offset: 3px; }
.works-reading a:hover { background: #dcebd8; }


.works-gallery { width: min(calc(100% - 40px), 1120px); margin: 24px auto 40px; }
.works-gallery h2 { margin: 0 0 12px; color: #193e2c; font: 650 clamp(20px, 3vw, 29px)/1.2 var(--display, system-ui); }
.works-gallery-stage {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  max-height: 66dvh;
  overflow: hidden;
  border-radius: 6px;
  background: #e8eee4;
}
.works-gallery-cover { position: absolute; inset: 0; display: grid; place-items: center; cursor: zoom-in; }
.works-gallery-cover:focus-visible { outline-offset: -5px; }
.works-gallery-cover img { width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; }
.works-gallery-cover img.works-photo-rotated { position: absolute; width: min(56.25vw, 630px, 66dvh); height: min(90vw, 1120px); transform: rotate(90deg); }
.works-gallery-controls { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; padding-inline: 8px; pointer-events: none; }
.works-gallery-controls button { pointer-events: auto; }
.works-gallery-controls .works-gallery-count { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); min-width: 58px; padding: 4px 8px; border-radius: 20px; text-align: center; color: #fff; background: #102b21e8; font-variant-numeric: tabular-nums; }
.works-gallery-thumbs { display: flex; gap: 9px; overflow-x: auto; margin-top: 8px; padding: 5px 5px 10px; scrollbar-width: thin; }
.works-gallery-thumbs a { flex: 0 0 clamp(63px, 12vw, 110px); aspect-ratio: 3 / 2; position: relative; display: grid; place-items: center; overflow: hidden; border-radius: 4px; background: #e8eee4; }
.works-gallery-thumbs a[aria-current="true"] { outline: 2px solid #1e6d32; outline-offset: 2px; }
.works-gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.works-gallery-thumbs [data-photo-rotated] img { position: absolute; width: 66.667%; height: 150%; transform: rotate(90deg); }
@media (max-width: 600px) {
  .works-gallery { margin-block: 18px 30px; }
  .works-gallery-stage { aspect-ratio: 4 / 3; }
  .works-gallery-cover img.works-photo-rotated { width: min(66vw, 66dvh); }
}

.work-project .site-header { background: #f9fbf7; backdrop-filter: none; }
.work-project .article-meta:empty { display: none; }
.work-section-nav { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 27px; padding: 14px 18px; border-left: 2px solid #41af5c; background: #edf3e9; }
.work-section-nav a { color: #234534; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
