/* Linen scan by SpaceToast, public domain: https://commons.wikimedia.org/wiki/File:ClothPack19.jpg */
.mural-page {
  --mural-paper: #f7f4ed;
  --mural-ink: #312a23;
  --mural-edge: #706354;
  --mural-art-ratio: .75;
  --scene-height: min(840px, calc(100svh - var(--site-header-height, 60px)));
  margin: 0;
  color: var(--mural-ink);
  background: var(--mural-paper) url("canvas.webp") center top / 680px auto repeat;
}

.mural-walk {
  position: relative;
  height: calc(var(--scene-height) + var(--track-length, 0px));
  min-height: 470px;
  isolation: isolate;
}

.mural-stage {
  position: sticky;
  top: 0;
  height: var(--scene-height);
  min-height: 470px;
  overflow: hidden;
}

.mural-stage:focus-visible {
  outline: 1px solid var(--mural-edge);
  outline-offset: -3px;
}

#bridge-scene {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
}

.mural-walk.is-ready #bridge-scene { opacity: 1; }
.mural-walk:not(.is-ready) #walk-instructions { display: none; }

.mural-intro {
  position: absolute;
  left: clamp(22px, 6vw, 104px);
  top: clamp(42px, 20%, 188px);
  z-index: 1;
  width: min(27vw, 355px);
  pointer-events: none;
}

.mural-intro h1, .mural-index h2 {
  font-weight: 780;
  letter-spacing: -.088em;
  line-height: .91;
}

.mural-intro h1 {
  margin: 0 0 .17em;
  font-size: clamp(58px, 8.2vw, 127px);
}

.mural-intro p {
  max-width: 15ch;
  margin: .85rem 0 .55rem;
  font-size: clamp(.83rem, 1.3vw, 1.03rem);
  line-height: 1.4;
}

.mural-intro .walk-instructions {
  display: flex;
  align-items: flex-start;
  gap: .46em;
  max-width: 23ch;
}

.walk-cue {
  --cue-direction: .28em;
  flex: 0 0 auto;
  color: #6b5140;
  font-weight: 700;
}

@media (pointer: coarse) {
  .walk-cue {
    --cue-direction: -.28em;
    rotate: 180deg;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .mural-walk.show-scroll-cue .walk-cue {
    animation: walk-cue 1.45s ease-in-out 3;
  }
}

@keyframes walk-cue {
  0%, 65%, 100% { translate: 0; }
  34% { translate: 0 var(--cue-direction); }
}

.mural-intro a, .mural-footer a {
  width: fit-content;
  color: inherit;
  font-size: .85rem;
  text-decoration: none;
  border-bottom: 1px solid #5b48387d;
  padding-bottom: .22em;
  pointer-events: auto;
}

.mural-intro a:hover, .mural-footer a:hover { border-bottom-color: currentColor; }

.mural-controls {
  position: absolute;
  z-index: 1;
  right: clamp(22px, 5vw, 80px);
  bottom: clamp(12px, 4%, 43px);
  display: grid;
  grid-template-columns: 41px minmax(130px, auto) 41px;
  align-items: stretch;
  color: var(--mural-ink);
  background: #f8f5eedf;
  border-top: 1px solid #473b2c8c;
  border-bottom: 1px solid #473b2c5a;
}

.mural-controls[hidden] { display: none; }

.walk-arrow, #close-detail {
  appearance: none;
  padding: 0;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  font: inherit;
}

.walk-arrow {
  width: 100%;
  min-height: 47px;
  font-size: 1.15rem;
}

.walk-arrow:first-child { border-right: 1px solid #473b2c38; }
.walk-arrow:last-child { border-left: 1px solid #473b2c38; }
.walk-arrow:disabled { opacity: .35; cursor: default; }
.walk-arrow:not(:disabled):hover, .current-mural:hover { background: #dfd5c378; }

.current-mural {
  display: grid;
  gap: .1rem;
  align-content: center;
  justify-items: center;
  min-width: 160px;
  padding: .4rem .7rem;
  text-align: center;
  text-decoration: none;
  color: inherit;
}

.current-title { font-size: .79rem; }
.current-number { font-size: .68rem; font-variant-numeric: tabular-nums; opacity: .78; }

.mural-index {
  max-width: 1560px;
  padding: clamp(40px, 7vw, 110px) clamp(22px, 6vw, 104px) 0;
  margin: 0 auto;
  scroll-margin-top: 25px;
}

.mural-index h2 {
  margin: 0 0 .7em;
  font-size: clamp(42px, 6vw, 86px);
}

.mural-works {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(25px, 4.5vw, 78px) clamp(16px, 2.5vw, 42px);
  padding: 0;
  margin: 0;
  list-style: none;
}

.mural-works a { display: block; color: inherit; text-decoration: none; }
.mural-works a:hover span { text-decoration: underline; text-underline-offset: .25em; }
.mural-works span { display: block; padding-top: .65em; font-size: .88rem; }
.mural-works img {
  display: block;
  width: 100%;
  aspect-ratio: var(--mural-art-ratio);
  object-fit: contain;
  background: #eae4d954;
}

.mural-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-top: clamp(50px, 8vw, 118px);
  padding: 1.2rem 0 1.8rem;
  border-top: 1px solid #473b2c55;
}

.mural-dialog {
  width: fit-content;
  max-width: calc(100vw - 28px);
  max-height: calc(100svh - 28px);
  padding: .7rem .8rem .8rem;
  color: var(--mural-ink);
  background: var(--mural-paper);
  border: 1px solid #675d4d;
  overflow: auto;
}

.mural-dialog::backdrop { background: #221b15c9; }
.detail-bar { display: flex; gap: 1.5rem; align-items: center; justify-content: space-between; margin-bottom: .55rem; }
.detail-bar h2 { margin: 0; font: inherit; font-weight: 600; }
#close-detail { font-size: 1.6rem; line-height: 1; width: 36px; height: 36px; }
#close-detail:hover { background: #dfd5c378; }
#detail-image {
  display: block;
  width: min(calc(100vw - 3.5rem), calc((100svh - 110px) * var(--mural-art-ratio)));
  aspect-ratio: var(--mural-art-ratio);
  object-fit: contain;
  background: #eae4d954;
}
#detail-image.is-loading { visibility: hidden; }

@media (prefers-reduced-motion: no-preference) {
  #detail-image.is-revealing { animation: reveal-paint 1s linear both; }
}

@keyframes reveal-paint {
  0%, 10% {
    clip-path: polygon(
      34% 35%, 36% 34%, 37% 36%, 39% 32%, 43% 33%, 45% 30%, 48% 33%, 51% 32%,
      54% 34%, 52% 36%, 56% 38%, 54% 40%, 57% 42%, 55% 43%, 56% 45%, 54% 46%,
      52% 49%, 49% 47%, 46% 50%, 43% 48%, 41% 51%, 39% 48%, 36% 49%, 34% 46%,
      32% 47%, 33% 44%, 30% 43%, 32% 41%, 29% 39%, 32% 38%, 31% 36%, 33% 37%
    );
  }
  47% {
    clip-path: polygon(
      14% 16%, 19% 13%, 23% 17%, 27% 9%, 37% 13%, 43% 7%, 53% 12%, 63% 10%,
      72% 14%, 70% 20%, 78% 24%, 75% 31%, 84% 38%, 80% 47%, 87% 55%, 82% 62%,
      79% 68%, 71% 63%, 63% 73%, 57% 68%, 49% 76%, 39% 71%, 32% 73%, 24% 66%,
      16% 69%, 17% 62%, 9% 56%, 12% 50%, 7% 41%, 11% 35%, 7% 26%, 13% 24%
    );
  }
  76% {
    clip-path: polygon(
      3% 4%, 11% 1%, 18% 5%, 25% -3%, 37% 2%, 46% -3%, 59% 1%, 73% -2%,
      88% 3%, 85% 12%, 95% 18%, 91% 28%, 100% 35%, 96% 48%, 103% 61%, 97% 73%,
      98% 86%, 87% 82%, 77% 94%, 67% 88%, 56% 98%, 45% 93%, 33% 95%, 19% 90%,
      4% 92%, 7% 80%, -1% 72%, 4% 62%, -3% 49%, 2% 38%, -2% 24%, 3% 16%
    );
  }
  100% {
    clip-path: polygon(
      0 0, 12% 0, 25% 0, 37% 0, 50% 0, 63% 0, 75% 0, 88% 0,
      100% 0, 100% 12%, 100% 25%, 100% 37%, 100% 50%, 100% 63%, 100% 75%, 100% 88%,
      100% 100%, 88% 100%, 75% 100%, 63% 100%, 50% 100%, 37% 100%, 25% 100%, 12% 100%,
      0 100%, 0 88%, 0 75%, 0 63%, 0 50%, 0 37%, 0 25%, 0 12%
    );
  }
}

@media (max-width: 780px) {
  .mural-page { --scene-height: max(470px, calc(100svh - var(--site-header-height, 58px))); }
  .mural-intro { top: 25px; width: max-content; max-width: calc(100% - 44px); }
  .mural-intro h1 { font-size: clamp(58px, 12vw, 92px); }
  .mural-intro .walk-instructions { margin: .5rem 0 .2rem; max-width: 30ch; }
  .mural-controls { right: 20px; bottom: 17px; }
  .mural-works { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 360px) {
  .mural-intro h1 { font-size: 53px; }
  .mural-controls { right: 15px; }
  .current-mural { min-width: 135px; }
}

@media (max-height: 520px) {
  .mural-page { --scene-height: max(260px, calc(100svh - var(--site-header-height, 58px))); }
  .mural-walk, .mural-stage { min-height: 260px; }
  .mural-intro { top: 24px; }
  .mural-intro h1 { font-size: clamp(48px, 11vh, 82px); }
}

@media (prefers-reduced-motion: reduce) {
  .mural-walk { height: var(--scene-height); }
  .mural-stage { position: relative; }
  .walk-cue { display: none; }
}
