/* Slide stage rendering. Positions are % of the stage; lengths are cqw (1% of stage width). */

.stage {
  position: relative;
  aspect-ratio: var(--aspect);
  width: min(100vw, 100dvh * var(--aspect));
  container-type: inline-size;
  overflow: hidden;
  isolation: isolate;
}

.stage .bg,
.stage .el {
  position: absolute;
}

.stage .bg {
  inset: 0;
}

.stage .bg img,
.stage .pic img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  max-width: none;
}

.stage .pic {
  overflow: hidden;
}

.stage .pic.photo {
  background: #1b1b1b; /* shows while the photo loads */
}

.stage .shape svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.stage .text {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-weight: var(--w-light);
  line-height: 1.2;
}

.stage .text p {
  margin: 0;
}

.stage .text .b {
  font-weight: var(--w-bold);
}

.stage .text .i {
  font-style: italic;
}

.stage .text.anchor-ctr {
  justify-content: center;
}

.stage .text.anchor-b {
  justify-content: flex-end;
}

/* ---------------------------------------------------------------- mobile (portrait) layout */
/* The mobile stage fills the screen; cqw/cqh are 1% of its width/height. */

.stage.mobile {
  display: none;
  position: relative;
  width: 100vw;
  height: 100dvh;
  container-type: size;
  overflow: hidden;
  isolation: isolate;
}

@media (orientation: portrait) {
  .stage.desktop {
    display: none;
  }

  .stage.mobile {
    display: block;
  }
}

.m-backdrop {
  position: absolute;
  inset: 0;
}

.m-backdrop img {
  width: 100%;
  height: 100%;
  display: block;
}

.m-group {
  position: absolute;
  left: 50%;
  top: calc(var(--m-top) + (100cqh - var(--m-top) - var(--m-bottom)) / 2);
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  max-width: 100cqw;
}

.m-photo {
  position: relative;
  width: var(--pw);
  flex: none;
}

.m-pic {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1b1b1b;
}

.m-pic img,
.m-attached img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.m-attached {
  position: absolute;
}

.m-text {
  position: relative; /* above the plaque panel */
  font-family: var(--font-body);
  font-weight: var(--w-light);
  line-height: 1.2;
  text-align: center;
}

.m-text.nowrap {
  white-space: pre;
}

.m-text p {
  margin: 0;
}

.m-text .b {
  font-weight: var(--w-bold);
}

/* plaque: a rectangle with concave quarter-circle corners, drawn with borders so the
   corner radius stays round at any box size */
.m-plaque-wrap,
.m-plaque,
.m-plaque-fill {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.m-plaque {
  overflow: hidden;
}

/* same concave-corner outline as the plaque: one radial cut-out per quadrant */
.m-plaque-fill {
  --cut: transparent calc(var(--pl-r) - 0.5px), #000 var(--pl-r);
  --mask:
    radial-gradient(circle at 0 0, var(--cut)) 0 0 / 50.5% 50.5% no-repeat,
    radial-gradient(circle at 100% 0, var(--cut)) 100% 0 / 50.5% 50.5% no-repeat,
    radial-gradient(circle at 0 100%, var(--cut)) 0 100% / 50.5% 50.5% no-repeat,
    radial-gradient(circle at 100% 100%, var(--cut)) 100% 100% / 50.5% 50.5% no-repeat;
  background: rgb(31 32 35 / 0.88);
  -webkit-mask: var(--mask);
  mask: var(--mask);
}

.m-plaque::before,
.m-plaque::after {
  content: "";
  position: absolute;
  border: 0 solid var(--pl-c);
}

.m-plaque::before {
  inset: 0 var(--pl-r);
  border-top-width: var(--pl-w);
  border-bottom-width: var(--pl-w);
}

.m-plaque::after {
  inset: var(--pl-r) 0;
  border-left-width: var(--pl-w);
  border-right-width: var(--pl-w);
}

.m-plaque i {
  position: absolute;
  width: calc(var(--pl-r) * 2);
  height: calc(var(--pl-r) * 2);
  border: var(--pl-w) solid var(--pl-c);
  border-radius: 50%;
  box-sizing: border-box;
}

.m-plaque i:nth-child(1) { left: calc(var(--pl-r) * -1); top: calc(var(--pl-r) * -1); }
.m-plaque i:nth-child(2) { right: calc(var(--pl-r) * -1); top: calc(var(--pl-r) * -1); }
.m-plaque i:nth-child(3) { left: calc(var(--pl-r) * -1); bottom: calc(var(--pl-r) * -1); }
.m-plaque i:nth-child(4) { right: calc(var(--pl-r) * -1); bottom: calc(var(--pl-r) * -1); }

.m-orn {
  position: absolute;
  left: 50%;
  z-index: 3;
  transform: translate(-50%, -50%);
}

.m-orn-top {
  top: 0;
}

.m-orn-bottom {
  top: 100%;
}

.m-orn img {
  display: block;
  width: 100%;
  height: auto;
}
