:root {
  color-scheme: light;
  font-family: 'Times New Roman', Times, serif;
  color: #171717;
  background: #fff;
  --type-scale: .8;
  --masthead-font-size: calc(clamp(1rem, 1.35vw, 1.8rem) * var(--type-scale));
  --gutter: clamp(1.25rem, 4vw, 4rem);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-size: calc(1em * var(--type-scale));
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.masthead {
  position: absolute;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  inset-inline-end: max(env(safe-area-inset-right), var(--gutter));
  z-index: 1;
  inset-block-start: max(env(safe-area-inset-top), clamp(1.25rem, 4vh, 2.75rem));
  inset-inline-start: max(env(safe-area-inset-left), var(--gutter));
}

.masthead h1 {
  margin: 0;
  font-size: calc(clamp(1.9rem, 3vw, 2.7rem) * var(--type-scale));
  font-weight: 400;
  line-height: 1;
  letter-spacing: -.025em;
}

.gallery {
  display: grid;
  place-items: center;
  height: 100%;
  margin-inline: auto;
  padding: max(5.25rem, calc(env(safe-area-inset-top) + 4rem))
    max(var(--gutter), env(safe-area-inset-right))
    max(2.5rem, calc(env(safe-area-inset-bottom) + 1rem))
    max(var(--gutter), env(safe-area-inset-left));
  container-type: size;
}

.exhibit {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) 3rem;
  grid-template-rows: auto 4.15rem;
  column-gap: clamp(1rem, 5vw, 5rem);
  width: min(100cqw, calc((100cqh - 4.15rem) + 6rem + 2 * clamp(1rem, 5vw, 5rem)), 61rem);
  align-items: center;
}

.print {
  display: grid;
  grid-template-rows: subgrid;
  grid-area: 1 / 2 / 3 / 3;
  min-width: 0;
  margin: 0;
}

.artwork {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: #f4f3f1;
}

.artwork img {
  position: absolute;
  display: block;
  inset: 0;
  width: 100%;
  height: auto;
}

figcaption {
  display: grid;
  justify-items: center;
  align-self: center;
  gap: .35rem;
  text-align: center;
  font-size: calc(1rem * var(--type-scale));
  line-height: 1.25;
  font-variant-numeric: lining-nums tabular-nums;
}

.arrow {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.arrow span {
  position: relative;
  width: 1.125rem;
  height: 1px;
  background: currentColor;
}

.arrow span::after {
  position: absolute;
  inset: 0 0 auto auto;
  width: .42rem;
  height: .42rem;
  border-block-start: 1px solid currentColor;
  border-inline-end: 1px solid currentColor;
  content: '';
  transform: translate(-1px, -3px) rotate(45deg);
}

.previous { grid-area: 1 / 1; }
.previous span { transform: rotate(180deg); }
.next { grid-area: 1 / 3; }
.arrow:focus-visible { outline: 1px solid currentColor; }

@media (hover: hover) {
  .arrow:hover { background: #f6f6f6; }
}

@media (max-width: 36rem) {
  .exhibit {
    width: min(100cqw, calc((100cqh - 4.15rem)));
    column-gap: 0;
  }

  .print {
    grid-area: 1 / 1 / 3 / 4;
    grid-template-columns: subgrid;
  }

  .artwork { grid-column: 1 / -1; }
  figcaption { grid-area: 2 / 2; }
  .arrow { z-index: 1; }
  .previous { grid-area: 2 / 1; }
  .next { grid-area: 2 / 3; }
}

@media (max-height: 30rem) {
  .gallery { padding-block: 3.7rem max(.5rem, env(safe-area-inset-bottom)); }
}

a { color: inherit; }
a:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }

.masthead a,
figcaption a {
  text-underline-offset: .23em;
  text-decoration-thickness: 1px;
}

.masthead nav a { text-decoration: none; }
.masthead nav a:hover { text-decoration: underline; }
.masthead .wordmark { text-decoration: none; }

figcaption a {
  color: #4e4b48;
  font-size: calc(.95rem * var(--type-scale));
  padding: .15rem .35rem;
}

.landing-page {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.collection-header {
  position: relative;
  inset: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: baseline;
  padding: max(env(safe-area-inset-top), clamp(1rem, 5dvh, 4rem))
    max(env(safe-area-inset-right), calc(3.5vw - (100vw - 100%)))
    .35rem
    max(env(safe-area-inset-left), 2.5vw);
  font-size: var(--masthead-font-size);
  font-weight: 400;
  line-height: 1.15;
}

.collection-header .artist-name { margin: 0; }

.collection-header h1 {
  font: inherit;
  letter-spacing: normal;
  text-align: center;
  transform: translateX(.5vw);
}

.collection-header nav { justify-self: end; }

.landing-page .gallery {
  width: 100%;
  padding-block: clamp(1.5rem, 5dvh, 3rem) max(2dvh, env(safe-area-inset-bottom));
}

.landing-page .exhibit {
  --caption-space: clamp(4.5rem, 11dvh, 8rem);
  position: relative;
  display: block;
  width: min(100cqw, 49.25vw, calc(max(0px, 100cqh - var(--caption-space))));
}

.mobile-series-title { display: none; }

.landing-page .print { display: block; }

.landing-page figcaption {
  height: var(--caption-space);
  grid-template-rows: auto 1fr;
  gap: .25rem;
  padding-top: clamp(.6rem, 1.9dvh, 1.4rem);
  font-size: calc(clamp(.95rem, 1.35vw, 1.8rem) * var(--type-scale));
  font-weight: 400;
}

.landing-page #caption {
  justify-self: start;
  text-transform: uppercase;
}

.landing-page figcaption a {
  align-self: end;
  color: inherit;
  font: inherit;
}

.landing-page .arrow {
  position: absolute;
  top: calc((100% - var(--caption-space)) / 2);
  transform: translateY(-50%);
  color: #595959;
}

.landing-page .previous { right: calc(100% + clamp(.5rem, 3vw, 4rem)); }
.landing-page .next { left: calc(100% + clamp(.5rem, 3vw, 4rem)); }

@media (max-width: 40rem) {
  .collection-header {
    grid-template-columns: 1fr 1fr;
    row-gap: 1.25rem;
    padding-inline: var(--gutter) max(env(safe-area-inset-right), calc(var(--gutter) - (100vw - 100%)));
  }

  .collection-header h1 {
    grid-area: 2 / 1 / 3 / -1;
    transform: none;
  }

  .landing-page .collection-header h1 { display: none; }

  .landing-page .exhibit {
    width: min(100cqw, calc(max(0px, 100cqh - var(--caption-space) - 3.5rem)));
  }

  .mobile-series-title {
    display: block;
    margin: 0 0 2.5rem;
    font-size: var(--masthead-font-size);
    font-weight: 400;
    text-align: center;
  }

  .landing-page figcaption { grid-template-rows: auto 3rem; align-content: space-between; }
  .landing-page figcaption a { align-self: center; }

  .landing-page .arrow {
    top: auto;
    bottom: 0;
    transform: none;
  }

  .landing-page .previous { right: auto; left: 0; justify-items: start; }
  .landing-page .next { right: 0; left: auto; justify-items: end; }
  .landing-page .arrow span::after { transform: translate(-2px, -3px) rotate(45deg); }
}

@media (max-height: 30rem) {
  .collection-header { row-gap: .35rem; }
  .landing-page .exhibit { --caption-space: 4.25rem; }
}

.landing-page .collection-header h1 a,
.mobile-series-title a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .23em;
}

.artwork .framing-preview {
  /* The frame is centered in the 1310px square starting at x = 337. */
  inset: 0 auto auto -25.7252%;
  width: 156.3359%;
}

.landing-page .framing-caption {
  grid-template-columns: 1fr 1fr;
  align-items: start;
  column-gap: .75rem;
  font-size: calc(clamp(.85rem, 1.2vw, 1.35rem) * var(--type-scale));
}

.landing-page .framing-caption #caption {
  justify-self: start;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
}

.framing-caption #framing-note {
  justify-self: end;
  text-align: right;
}
