.stills-sheet {
  --sheet-bg: #0b0b0c;
  --sheet-ink: #e8e2d6;
  --sheet-accent: #e8e2d6;
  position: relative;
  width: 100%;
  color: var(--sheet-ink);
}

.stills-sheet:not(.stills-sheet--ready) {
  min-height: 70vh;
}

.stills-sheet__sheet,
.stills-sheet__plate {
  position: relative;
  width: 100%;
}

.stills-sheet__plate {
  position: absolute;
  inset: 0 auto auto 0;
  background: var(--sheet-bg);
  transform-origin: 0 0;
}

.stills-sheet__cell {
  position: absolute;
  display: block;
  box-sizing: border-box;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  background-color: var(--sheet-bg);
}

.stills-sheet__cell--frame {
  appearance: none;
  background-repeat: no-repeat;
  cursor: pointer;
  image-rendering: pixelated;
}

.stills-sheet__source-thumbnail {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  transform: translate(-50%, -50%);
  background-repeat: no-repeat;
  pointer-events: none;
}

.stills-sheet__cell--frame:focus-visible {
  z-index: 1;
  outline: none;
  box-shadow: inset 0 -2px 0 var(--sheet-accent);
}

.stills-sheet__stage .stills-sheet__cell--frame:focus-visible {
  box-shadow: none;
}

.stills-sheet__cell--empty {
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 8%);
  pointer-events: none;
}

.stills-sheet__cell--dimmed {
  opacity: 0.35;
}

.stills-sheet__cell--focused {
  z-index: 2;
}

.stills-sheet__focus-image {
  position: absolute;
  z-index: 3;
  display: block;
  margin: 0;
  object-fit: contain;
  pointer-events: none;
}

/* The full-size file for a cell left on screen around an open still,
   placed by the script inside the cell over its thumbnail. */
.stills-sheet__neighbour-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: contain;
  pointer-events: none;
}

.stills-sheet__stage {
  position: fixed;
  z-index: 2147483000;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--sheet-bg, #0b0b0c);
  touch-action: none;
}

.stills-sheet__stage .stills-sheet__plate {
  position: absolute;
  inset: 0 auto auto 0;
}

.stills-sheet__stage .stills-sheet__row-marker {
  display: none;
}

.stills-sheet__label {
  position: absolute;
  z-index: 4;
  color: var(--sheet-ink);
  font-family: var(--wp--preset--font-family--nav, system-ui, sans-serif);
  font-size: var(--wp--preset--font-size--small, 0.75rem);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.12em;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.4rem);
  transition-property: opacity;
  transition-timing-function: linear;
  max-width: calc(100vw - 16px);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.stills-sheet__label--visible {
  opacity: 0.7;
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
}

.stills-sheet__label-id {
  cursor: copy;
}

.stills-sheet__close {
  position: absolute;
  z-index: 5;
  top: 0;
  right: 0;
  display: grid;
  width: 44px;
  height: 44px;
  margin: 0;
  border: 0;
  padding: 0;
  color: var(--sheet-ink);
  background: transparent;
  font: 300 1.5rem/1 system-ui, sans-serif;
  opacity: 0.6;
  place-items: center;
  cursor: pointer;
}

.stills-sheet__close:focus-visible {
  outline: 1px solid var(--sheet-accent);
  outline-offset: -3px;
}

.stills-sheet__live-region {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.stills-sheet__row-marker {
  position: absolute;
  right: calc(100% + 0.65rem);
  color: var(--sheet-ink);
  font-family: var(--wp--preset--font-family--nav, system-ui, sans-serif);
  font-size: var(--wp--preset--font-size--small, 0.75rem);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.12em;
  line-height: 1;
  opacity: 0.4;
  white-space: nowrap;
}

.stills-sheet__unavailable {
  margin: 0;
  color: var(--sheet-ink);
  opacity: 0.5;
}

/* The pointer hides after two seconds still in the viewer (stills-sheet.js). */
.stills-sheet__stage--idle,
.stills-sheet__stage--idle * {
  cursor: none !important;
}

/* No image callout, magnifier or text selection on a long press: the frame
   menu below takes their place. The label turns selection back on while it
   is visible, so its ID can still be highlighted. */
.stills-sheet__cell,
.stills-sheet__focus-image,
.stills-sheet__neighbour-image,
.stills-sheet__stage {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* The frame menu: a right click or a long press on a frame. */
.stills-sheet__menu {
  position: fixed;
  z-index: 2147483001;
  padding: 4px;
  border: 1px solid rgb(186 171 154 / 35%);
  border-radius: 2px;
  background: rgb(0 0 0 / 88%);
}

.stills-sheet__menu-item {
  display: block;
  min-height: 44px;
  margin: 0;
  border: 0;
  padding: 0 14px;
  background: none;
  color: var(--sheet-ink, #baab9a);
  font-family: var(--wp--preset--font-family--nav, system-ui, sans-serif);
  font-size: var(--wp--preset--font-size--small, 0.75rem);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.12em;
  white-space: nowrap;
  cursor: pointer;
}

.stills-sheet__menu-item:hover,
.stills-sheet__menu-item:focus-visible {
  outline: none;
  background: rgb(255 255 255 / 8%);
}
