.work {
  background: #152b40;
  color: #faf8ef;
}
.work .section {
  padding-block: clamp(3.25rem, 6.6vw, 6.75rem);
}
.work-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-bottom: clamp(1.55rem, 3vw, 3.15rem);
  padding-bottom: clamp(1.1rem, 2.1vw, 1.8rem);
  border-bottom: 1px solid #587080;
}
.work-heading h2 {
  font-size: clamp(3.1rem, 5.4vw, 5.75rem);
}
.work-heading p, .collection-description {
  color: #ced9de;
  font-size: 1rem;
  line-height: 1.5;
}
.work-heading p { font-size: .9375rem; }
.collection-covers {
  display: grid;
  grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
  align-items: end;
  column-gap: clamp(1.55rem, 4.5vw, 4.5rem);
  row-gap: 2.25rem;
}
.collection-cover { display: block; min-width: 0; }
.collection-image {
  overflow: hidden;
  background: #213548;
  aspect-ratio: 4 / 3;
}
.collection-cover:nth-child(even) .collection-image { aspect-ratio: 1.54; }
.collection-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.collection-caption {
  display: flex;
  gap: .45rem 1.25rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: clamp(.8rem, 1.45vw, 1.2rem);
}
.collection-caption h3, .collection-panel h3 {
  font: 400 clamp(2.3rem, 3.1vw, 3.35rem)/1.05 var(--serif);
  letter-spacing: -.025em;
}
.collection-action {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
  font-weight: 550;
  white-space: nowrap;
}
.collection-description { margin-top: .46rem; }
.collection-cover:hover .collection-action, .collection-cover:focus-visible .collection-action {
  text-decoration: underline; text-underline-offset: .23em;
}
.work :focus-visible { outline-color: #aed7ea; }
.collection-panel { display: none; }
.collection-panel:target {
  display: block;
  padding-top: 2.5rem;
  margin-top: 2.5rem;
  border-top: 1px solid #597080;
}
.gallery-enhanced .collection-panel:target { display: none; }
.collection-panel ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.75rem), 1fr));
  list-style: none;
  gap: 1.35rem;
  padding: 1rem 0;
}
.collection-panel li img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; margin: 0 0 .4rem; }
.collection-panel a { text-decoration: underline; text-underline-offset: .22em; }

html.gallery-open { overflow: hidden; }
.gallery-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  height: 100dvh;
  max-height: none;
  padding: 0;
  margin: 0;
  border: 0;
  background: #101e2a;
  color: #fbf8f0;
  overflow: auto;
  overscroll-behavior: contain;
}
.gallery-viewer:not([open]) { display: none; }
.gallery-viewer::backdrop { background: #101e2a; }
.viewer-layout {
  --viewer-gutter: clamp(1.05rem, 4.3vw, 4.75rem);
  display: grid;
  grid-template-rows: auto minmax(5rem, 1fr) auto auto;
  width: min(100%, 100rem);
  height: 100%;
  margin: 0 auto;
  padding: max(.8rem, env(safe-area-inset-top)) max(var(--viewer-gutter), env(safe-area-inset-right)) max(.8rem, env(safe-area-inset-bottom)) max(var(--viewer-gutter), env(safe-area-inset-left));
}
.viewer-header, .viewer-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.viewer-header { padding-bottom: .65rem; }
.viewer-header h2 { font-size: clamp(2.1rem, 3.1vw, 3.3rem); line-height: 1.06; }
.gallery-viewer button {
  font-family: inherit;
  color: inherit;
  background: transparent;
  cursor: pointer;
}
.viewer-close, .viewer-controls button {
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: .45rem .9rem;
  border: 1px solid #748695;
  border-radius: 2px;
  font-size: .9375rem;
  line-height: 1.25;
}
.viewer-close { display: inline-flex; align-items: center; justify-content: center; gap: .65rem; }
.viewer-close:hover, .viewer-controls button:hover { background: #2d4151; }
.viewer-stage {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  background: #0b151e;
  touch-action: pan-y pinch-zoom;
}
.viewer-stage img { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.viewer-caption {
  min-height: 4rem;
  padding-block: .7rem;
  border-bottom: 1px solid #475b69;
}
.viewer-label { display: flex; align-items: baseline; gap: clamp(.6rem, 1.7vw, 1.5rem); min-width: 0; }
.viewer-position {
  min-width: 2.6rem;
  color: #b9cbd5;
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.viewer-name { font-size: clamp(1rem, 1.6vw, 1.32rem); line-height: 1.25; }
.viewer-controls { display: flex; gap: .4rem; }
.viewer-controls[hidden], .viewer-strip[hidden] { display: none; }
.viewer-strip {
  display: flex;
  gap: .5rem;
  width: 100%;
  min-width: 0;
  padding: .68rem .2rem .12rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #718492 transparent;
}
.viewer-strip button {
  flex: 0 0 auto;
  width: clamp(3.85rem, 7vw, 5.2rem);
  height: clamp(2.8rem, 4.55vw, 3.75rem);
  border: 2px solid transparent;
  padding: 2px;
}
.viewer-strip img { width: 100%; height: 100%; object-fit: cover; opacity: .72; }
.viewer-strip button[aria-current="true"] { border-color: #f7f3e8; }
.viewer-strip button[aria-current="true"] img, .viewer-strip button:hover img { opacity: 1; }
.viewer-strip button:focus-visible { outline-offset: -2px; }

@media (max-width: 639px) {
  .work-heading { display: block; }
  .work-heading p { margin-top: .55rem; }
  .collection-covers { grid-template-columns: 1fr; }
  .collection-cover:nth-child(even) .collection-image { aspect-ratio: 1.5; }
  .collection-caption { margin-top: .85rem; }
  .collection-description { margin-top: .32rem; }
  .viewer-layout { --viewer-gutter: .8rem; }
  .viewer-caption { gap: .6rem; }
  .viewer-label { display: grid; gap: .15rem; }
  .viewer-controls button { padding-inline: .65rem; }
}
@media (max-height: 480px) and (orientation: landscape) {
  .viewer-layout {
    grid-template-columns: minmax(0, 1fr) 4.75rem;
    grid-template-rows: auto minmax(5rem, 1fr) auto;
    gap: 0 .8rem;
    padding-block: max(.2rem, env(safe-area-inset-top)) max(.2rem, env(safe-area-inset-bottom));
  }
  .viewer-header { grid-column: 1 / -1; padding-bottom: .22rem; }
  .viewer-header h2 { font-size: 2rem; }
  .viewer-stage { grid-column: 1; grid-row: 2; }
  .viewer-caption { grid-column: 1 / -1; grid-row: 3; min-height: 0; padding: .25rem 0; border: 0; }
  .viewer-strip { grid-column: 2; grid-row: 2; flex-direction: column; overflow: auto; min-height: 0; padding: .16rem; }
  .viewer-strip button { width: 100%; }
}

