.motion-gallery[hidden],
.motion-gallery [hidden],
.link[data-motion-link][hidden],
.motion-kitchen-actions[hidden],
.motion-kitchen-actions [hidden],
.motion-gallery-magazine[hidden],
.motion-gallery-magazine [hidden] {
  display: none !important;
}

.motion-gallery__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.25rem, 4vw, 4rem);
  margin-top: clamp(1.5rem, 4vw, 3.5rem);
}

.motion-gallery[data-motion-count="1"] .motion-gallery__card {
  width: min(100%, 48rem);
  grid-column: 1 / -1;
}

.motion-gallery__title {
  margin: 0 0 .65rem;
  font-size: clamp(1.25rem, 2.4vw, 1.8rem);
  font-weight: 400;
}

.motion-gallery__screen {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin: 0;
  aspect-ratio: 1672 / 941;
  background: #171512;
}

.motion-gallery__poster,
.motion-gallery__film {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.motion-gallery__film {
  pointer-events: none;
}

.motion-gallery__film .fa-motion-layer--manual {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #171512;
}

.motion-gallery__poster,
.motion-gallery__film video {
  display: block;
  object-fit: contain;
  object-position: center;
  transform: none;
}

.motion-gallery__film video {
  width: 100%;
  height: 100%;
}

.motion-gallery__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin-top: .65rem;
}

.motion-gallery__button {
  min-height: 44px;
  padding: .45rem .8rem;
  border: 1px solid currentColor;
  border-radius: 2px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: .875rem;
  cursor: pointer;
}

.motion-gallery__button:hover {
  background: rgb(255 255 255 / 12%);
}

.motion-gallery__button:focus-visible {
  outline: 2px solid #d5ad82;
  outline-offset: 3px;
}

.motion-gallery__status {
  min-height: 0;
  margin: 0;
  font-size: .875rem;
}

.motion-gallery__status:not(:empty) {
  margin-top: .55rem;
}

.stage:has(> .motion-gallery-magazine:not([hidden])) {
  container-type: size;
  grid-template-rows: minmax(0, 1fr) auto;
}

.motion-gallery-magazine {
  grid-area: 2 / 1 / 3 / -1;
  min-width: 0;
  display: flex;
  justify-content: center;
  padding: .25rem max(.65rem, env(safe-area-inset-right)) .25rem max(.65rem, env(safe-area-inset-left));
}

.motion-gallery-magazine:has(> [data-motion-compact-lights]:not([hidden])) {
  min-height: 4.375rem;
  align-items: center;
  flex-wrap: wrap;
  gap: .375rem 1rem;
}

.motion-magazine-lights {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem;
}

.motion-magazine-lights .motion-gallery__button {
  min-width: 44px;
  white-space: nowrap;
}

.motion-magazine-lights .motion-gallery__button[aria-pressed="true"] {
  background: #ece4d7;
  color: #26211c;
  border-color: #ece4d7;
}

.stage:has(> .motion-gallery-magazine > [data-motion-compact-lights]:not([hidden])) [data-book] .has-lights .lights {
  display: none;
}

.motion-gallery__reader {
  --motion-reader-chrome: 4.75rem;
  box-sizing: border-box;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  padding: .45rem;
  border: 1px solid #8b7763;
  border-radius: 4px;
  background: #211d19;
  color: #f3eee7;
  pointer-events: auto;
}

.motion-gallery__reader .motion-gallery__controls {
  margin: 0;
}

.motion-gallery__reader:has(.motion-gallery__status:not(:empty)) {
  --motion-reader-chrome: 8.25rem;
}

.motion-gallery__reader .motion-gallery__status:not(:empty) {
  max-height: 2.75rem;
  overflow-wrap: anywhere;
  overflow-y: auto;
}

.motion-gallery__reader .motion-gallery__screen {
  width: min(calc(100vw - 2.5rem), 48rem, 76vh);
  width: min(calc(100vw - 2.5rem), 48rem, 76svh);
  width: min(calc(100vw - 2.5rem), 48rem, 76svh, max(0px, calc((100cqh - var(--motion-reader-chrome)) * 1.7768)));
  max-width: 100%;
  margin-bottom: .45rem;
}

@media (orientation: landscape) and (max-height: 34rem) {
  .toolbar[data-toolbar] {
    min-width: 0;
    flex-wrap: wrap;
    gap: .25rem .5rem;
  }

  .toolbar[data-toolbar] .toolbar__progress {
    flex: 1 1 10rem;
  }

  .toolbar[data-toolbar] .toolbar__tools {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    flex-wrap: wrap;
  }

  .toolbar[data-toolbar] .toolbar__more-toggle {
    display: inline-flex;
  }

  .toolbar[data-toolbar] .toolbar__more {
    position: absolute;
    inset: auto max(.5rem, env(safe-area-inset-right)) calc(100% + .4rem) auto;
    z-index: 8;
    display: none;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: .15rem;
    max-width: calc(100% - 1rem - env(safe-area-inset-left) - env(safe-area-inset-right));
    max-height: 50svh;
    overflow: auto;
    padding: .25rem;
    border-radius: 8px;
    background: #141210f0;
    box-shadow: 0 6px 24px #00000059;
  }

  .toolbar[data-toolbar].is-more-open .toolbar__more {
    display: flex;
  }

  .toolbar[data-toolbar] .zoomer__slider input {
    width: clamp(3rem, 8vw, 6.5rem);
  }

  .toolbar[data-toolbar] .listen-player {
    flex-wrap: wrap;
  }

  .toolbar[data-toolbar] .listen-player__now {
    flex: 1 1 10rem;
  }

  .toolbar[data-toolbar] .listen-player__seek {
    flex: 1 1 5rem;
  }
}

.motion-kitchen-actions {
  position: relative;
  inline-size: min(100%, 14rem);
}

.light__head:has(.motion-kitchen-actions:not([hidden])) .light__hours {
  margin-inline-start: auto;
}

.motion-kitchen-actions .motion-gallery__controls {
  margin-top: 0;
}

.motion-kitchen-actions .motion-gallery__status:not(:empty) {
  position: absolute;
  inset: 100% 0 auto;
  z-index: 3;
  margin: .25rem 0 0;
  padding: .45rem .65rem;
  background: #211d19;
  color: #f3eee7;
}

.motion-kitchen-covered {
  position: relative;
}

.motion-kitchen-covered > .motion-gallery__screen {
  position: absolute;
  inset: 0 0 auto;
  z-index: 1;
  background: transparent;
}

.motion-kitchen-covered > .light__frame {
  pointer-events: none;
}

.light.is-enhanced .motion-kitchen-covered:has(.fa-motion-layer--manual[data-ready="true"]:not([hidden])) > .light__caption {
  visibility: hidden;
}

@media (max-width: 650px) {
  .motion-gallery__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .light__head:has(.motion-kitchen-actions:not([hidden])) .light__hours {
    margin-inline-start: 0;
  }
}

@media print {
  .motion-gallery-magazine,
  .motion-kitchen-actions,
  .motion-kitchen-covered > .motion-gallery__screen,
  .motion-gallery {
    display: none !important;
  }
}
