.gallery-page {
  --content: 1560px;
  min-height: 100dvh;
}

.gallery-page [hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.gallery-main {
  width: min(100%, var(--content));
  margin: 0 auto;
  padding: 38px var(--page-pad) 0;
}

.gallery-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 48px;
  min-height: 96px;
  padding-bottom: 28px;
}

.gallery-overline,
.gallery-kicker {
  color: var(--brass);
  font-size: 11px;
  line-height: 1.4;
}

.gallery-heading h1 {
  margin-top: 7px;
  font-family: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  font-size: 38px;
  line-height: 1.2;
  font-weight: 500;
}

.gallery-toolbar,
.gallery-series,
.gallery-mode,
.gallery-zoom,
.gallery-navigation {
  display: flex;
  align-items: center;
}

.gallery-toolbar {
  justify-content: flex-end;
  gap: 16px;
}

.gallery-series,
.gallery-mode,
.gallery-zoom {
  border: 1px solid var(--line);
}

.gallery-series button,
.gallery-mode button,
.gallery-zoom button {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.gallery-zoom button {
  min-width: 44px;
}

.gallery-series button:last-child,
.gallery-mode button:last-child,
.gallery-zoom button:last-child {
  border-right: 0;
}

.gallery-series button[aria-pressed="true"],
.gallery-mode button[aria-pressed="true"],
.gallery-zoom button[aria-pressed="true"] {
  box-shadow: inset 0 -1px var(--brass);
  color: var(--paper);
}

.gallery-view {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(340px, 4fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.gallery-stage {
  position: relative;
  min-width: 0;
  min-height: clamp(560px, calc(100dvh - 250px), 760px);
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: #101010;
}

.gallery-single,
.gallery-image-scroll {
  width: 100%;
  height: 100%;
}

.gallery-single {
  height: clamp(560px, calc(100dvh - 250px), 760px);
}

.gallery-image-scroll {
  position: relative;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--brass) var(--surface);
}

.gallery-image-scroll[data-zoom-mode="fit"] {
  overflow: hidden;
}

.gallery-image-scroll[data-zoom-mode="fit"] .gallery-image {
  position: absolute;
  inset: 28px;
  width: calc(100% - 56px);
  height: calc(100% - 56px);
  object-fit: contain;
}

.gallery-image-scroll[data-zoom-mode="actual"] .gallery-image {
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
}

.gallery-image {
  opacity: 1;
  transition: opacity 180ms ease;
}

.gallery-image.is-loading {
  opacity: 0;
}

.gallery-image-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--quiet);
  font-size: 11px;
}

.gallery-image-loading[hidden] {
  display: none;
}

.gallery-overview {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  min-height: clamp(480px, 62dvh, 700px);
  background: var(--line);
  gap: 1px;
}

.gallery-overview-work {
  position: relative;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #101010;
  cursor: pointer;
}

.gallery-overview-work img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 240ms ease, opacity 180ms ease;
}

.gallery-overview-work:hover img,
.gallery-overview-work:focus-visible img {
  transform: scale(1.018);
}

.gallery-overview-element,
.gallery-overview-name {
  position: absolute;
  left: 16px;
  bottom: 14px;
  z-index: 1;
}

.gallery-overview-element {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(242, 239, 232, 0.36);
  background: rgba(9, 9, 9, 0.88);
  color: var(--paper);
  font-family: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  font-size: 16px;
}

.gallery-overview-name {
  right: 16px;
  bottom: 56px;
  padding: 8px 10px;
  background: rgba(9, 9, 9, 0.9);
  color: var(--paper);
  font-size: 11px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.gallery-overview-work:hover .gallery-overview-name,
.gallery-overview-work:focus-visible .gallery-overview-name {
  opacity: 1;
  transform: translateY(0);
}

.gallery-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 42px 40px 36px;
  background: var(--bg);
}

.gallery-status {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  color: var(--quiet);
  font-size: 11px;
}

.gallery-kicker {
  margin-top: 28px;
}

.gallery-copy h2 {
  margin-top: 12px;
  font-family: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  font-size: 38px;
  line-height: 1.28;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.gallery-description {
  margin-top: 24px;
  color: #d3cec4;
  font-size: 14px;
  line-height: 1.85;
}

.gallery-copy-details {
  margin-top: 32px;
}

.gallery-facts {
  border-top: 1px solid var(--line);
}

.gallery-facts > div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.gallery-facts dt {
  color: var(--quiet);
}

.gallery-facts dd {
  color: #d8d3ca;
}

.gallery-components {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 20px;
  color: #c9c3b8;
  font-size: 11px;
  list-style: none;
}

.gallery-components li::before {
  content: "・";
  color: var(--brass);
}

.gallery-inclusion,
.gallery-photo-note,
.gallery-ai-note,
.gallery-availability {
  margin-top: 14px;
  color: var(--quiet);
  font-size: 10px;
  line-height: 1.65;
}

.gallery-photo-note {
  padding-left: 10px;
  border-left: 1px solid var(--red);
  color: #c9c2b8;
}

.gallery-inquiry-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  margin-top: 26px;
  padding: 0 2px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--paper);
  font-size: 13px;
}

.gallery-inquiry-action span {
  color: var(--brass);
}

.gallery-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: auto;
  padding-top: 30px;
}

.gallery-navigation {
  gap: 8px;
}

.gallery-icon-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  color: var(--paper);
  font-size: 18px;
  cursor: pointer;
}

.gallery-view.is-overview {
  display: block;
}

.gallery-view.is-overview .gallery-stage {
  min-height: 0;
  border-right: 0;
}

.gallery-view.is-overview .gallery-copy {
  display: grid;
  grid-template-columns: minmax(270px, 4fr) minmax(320px, 5fr) minmax(280px, 3fr);
  align-items: start;
  gap: 48px;
  padding: 32px 0 36px;
}

.gallery-view.is-overview .gallery-status {
  padding-bottom: 14px;
}

.gallery-view.is-overview .gallery-kicker {
  margin-top: 18px;
}

.gallery-view.is-overview .gallery-copy h2 {
  font-size: 34px;
}

.gallery-view.is-overview .gallery-description,
.gallery-view.is-overview .gallery-copy-details {
  margin-top: 0;
}

.gallery-view.is-overview .gallery-ai-note,
.gallery-view.is-overview .gallery-availability {
  display: none;
}

.gallery-work-index {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-color: var(--brass) var(--surface);
}

.gallery-work-index button {
  display: grid;
  grid-template-columns: auto 1fr;
  align-content: center;
  min-height: 82px;
  flex: 0 0 clamp(210px, 20vw, 300px);
  gap: 4px 14px;
  padding: 14px 18px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.gallery-work-index button[aria-current="true"] {
  box-shadow: inset 0 1px var(--brass);
  background: var(--surface);
  color: var(--paper);
}

.gallery-index-number {
  grid-row: 1 / 3;
  align-self: center;
  color: var(--brass);
  font-size: 11px;
}

.gallery-index-name {
  font-family: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  font-size: 14px;
  line-height: 1.45;
}

.gallery-index-meta {
  color: var(--quiet);
  font-size: 11px;
}

.gallery-error {
  padding: 80px 0;
  color: var(--muted);
  text-align: center;
}

.gallery-footer {
  display: flex;
  justify-content: space-between;
  gap: 48px;
  width: min(100%, var(--content));
  margin: 72px auto 0;
  padding: 28px var(--page-pad) 36px;
  border-top: 1px solid var(--line);
  color: var(--quiet);
  font-size: 10px;
  line-height: 1.65;
}

.gallery-footer p {
  max-width: 720px;
}

.gallery-footer a {
  min-height: 44px;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .gallery-heading {
    align-items: start;
  }

  .gallery-toolbar {
    flex-wrap: wrap;
  }

  .gallery-view {
    grid-template-columns: minmax(0, 7fr) minmax(320px, 5fr);
  }

  .gallery-copy {
    padding: 34px 30px 30px;
  }

  .gallery-view.is-overview .gallery-copy {
    grid-template-columns: minmax(250px, 4fr) minmax(280px, 5fr) minmax(260px, 4fr);
    gap: 32px;
  }
}

@media (max-width: 1180px) {
  .gallery-overview {
    grid-auto-flow: column;
    grid-auto-columns: minmax(300px, 48vw);
    grid-template-columns: none;
    height: clamp(480px, 60dvh, 620px);
    min-height: 0;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline mandatory;
    scrollbar-color: var(--brass) var(--surface);
  }

  .gallery-overview-work {
    scroll-snap-align: start;
  }

  .gallery-overview-name {
    opacity: 1;
    transform: none;
  }

  .gallery-view.is-overview .gallery-copy {
    grid-template-columns: minmax(240px, 1fr) minmax(0, 1.4fr);
  }

  .gallery-view.is-overview .gallery-copy-details {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .gallery-main {
    padding: 26px var(--page-pad) 0;
  }

  .gallery-heading {
    display: grid;
    gap: 22px;
    padding-bottom: 24px;
  }

  .gallery-heading h1 {
    font-size: 32px;
  }

  .gallery-toolbar {
    display: grid;
    justify-content: stretch;
    gap: 10px;
    overflow-x: auto;
  }

  .gallery-series,
  .gallery-mode {
    width: max-content;
  }

  .gallery-view {
    grid-template-columns: 1fr;
  }

  .gallery-stage {
    min-height: 56svh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .gallery-single {
    height: 56svh;
  }

  .gallery-overview {
    grid-auto-flow: column;
    grid-auto-columns: 78vw;
    grid-template-columns: none;
    height: 58svh;
    min-height: 0;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline mandatory;
    scrollbar-color: var(--brass) var(--surface);
  }

  .gallery-overview-work {
    scroll-snap-align: start;
  }

  .gallery-overview-name {
    opacity: 1;
    transform: none;
  }

  .gallery-copy,
  .gallery-view.is-overview .gallery-copy {
    display: flex;
    padding: 28px 0 32px;
  }

  .gallery-copy-heading {
    display: flex;
    flex-direction: column;
  }

  .gallery-copy-heading .gallery-kicker {
    order: 1;
    margin-top: 0;
  }

  .gallery-copy-heading h2 {
    order: 2;
  }

  .gallery-copy-heading .gallery-status {
    order: 3;
    margin-top: 20px;
  }

  .gallery-view.is-overview .gallery-description,
  .gallery-view.is-overview .gallery-copy-details {
    margin-top: 26px;
  }

  .gallery-view.is-overview .gallery-copy h2,
  .gallery-copy h2 {
    font-size: 30px;
  }

  .gallery-actions {
    margin-top: 28px;
  }

  .gallery-work-index button {
    flex-basis: 68vw;
  }

  .gallery-footer {
    display: grid;
    gap: 22px;
    margin-top: 52px;
  }
}

@media (max-width: 390px) {
  .gallery-series button,
  .gallery-mode button,
  .gallery-zoom button {
    padding-inline: 13px;
  }

  .gallery-image-scroll[data-zoom-mode="fit"] .gallery-image {
    inset: 16px;
    width: calc(100% - 32px);
    height: calc(100% - 32px);
  }

  .gallery-copy h2,
  .gallery-view.is-overview .gallery-copy h2 {
    font-size: 28px;
  }
}

@media (max-height: 600px) and (orientation: landscape) {
  .gallery-main {
    padding-top: 14px;
  }

  .gallery-heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 18px;
    min-height: 0;
    padding-bottom: 14px;
  }

  .gallery-heading-copy {
    display: block;
  }

  .gallery-overline {
    display: none;
  }

  .gallery-heading h1 {
    margin-top: 0;
    font-size: 24px;
    white-space: nowrap;
  }

  .gallery-toolbar {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
  }

  .gallery-series button,
  .gallery-mode button {
    min-height: 44px;
    padding-inline: 10px;
    font-size: 11px;
  }

  .gallery-stage {
    min-height: 260px;
  }

  .gallery-single {
    height: 260px;
  }

  .gallery-overview {
    height: 260px;
    min-height: 260px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-image,
  .gallery-overview-work img,
  .gallery-overview-name {
    transition: none;
  }
}
