.video-share {
  display: contents;
}

.journey-video-mount .video-share-inline {
  display: none;
}

.film-figure figcaption:has(> .video-share) {
  flex-wrap: wrap;
}

.video-share button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  max-width: 100%;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1.5;
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 4px;
  touch-action: manipulation;
  cursor: pointer;
}

.video-share button:focus-visible, .video-share-link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.video-share button[hidden], .video-share-link[hidden] {
  display: none;
}

.video-share-status {
  flex: 0 0 100%;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.video-share-status:empty {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.video-share-link {
  box-sizing: border-box;
  flex: 0 0 100%;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid currentColor;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 16px;
  user-select: text;
  -webkit-user-select: text;
}

/* Match the external controls across dialogs while leaving playback to the player. */
.video-viewer {
  --viewer-ink: var(--tour-ink, var(--ink));
  --viewer-line: var(--tour-line, var(--line));
  --viewer-control: var(--tour-control, var(--soft));
  --viewer-focus: var(--tour-focus, var(--brand));
  border-radius: 16px;
}

.video-viewer .video-viewer-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--viewer-line);
  border-radius: 50%;
  color: var(--viewer-ink);
  background: var(--viewer-control);
  cursor: pointer;
  touch-action: manipulation;
}

.video-viewer .video-viewer-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.video-viewer .video-viewer-actions {
  --viewer-action-gap: 8px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: var(--viewer-action-gap);
  color: var(--viewer-ink);
  font: 500 13px/1.45 var(--sans);
}

.video-viewer-actions > .video-sound-toggle {
  grid-column: 1;
  grid-row: 1;
}

.video-viewer-actions > .video-share > button {
  grid-column: 2;
  grid-row: 1;
}

.video-viewer-actions > .video-viewer-options {
  grid-column: 3;
  grid-row: 1;
  min-width: 0;
}

.video-viewer .video-viewer-actions :is(.video-sound-toggle, .video-share > button, .video-viewer-options > summary, .video-viewer-recovery) {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 6px 4px;
  border: 1px solid var(--viewer-line);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  cursor: pointer;
  touch-action: manipulation;
}

.video-viewer .video-viewer-actions [hidden] { display: none !important; }
.video-viewer .video-viewer-actions .video-share > button,
.video-viewer .video-viewer-actions .video-viewer-recovery {
  background: var(--viewer-control);
}

.video-viewer .video-viewer-actions .video-sound-toggle[aria-pressed="false"] {
  color: var(--viewer-focus);
}

.video-viewer-options summary { list-style: none; }
.video-viewer-options summary::-webkit-details-marker { display: none; }

.video-viewer-options summary::after {
  content: '';
  display: block;
  flex: none;
  width: 6px;
  height: 6px;
  margin: -3px 1px 0;
  border: solid currentColor;
  border-width: 0 1px 1px 0;
  transform: rotate(45deg);
}

.video-viewer-options[open] > summary::after,
.video-viewer-options details[open] > summary::after {
  margin-top: 3px;
  transform: rotate(225deg);
}

/* The native disclosure expands across all three columns, below its trigger. */
.video-viewer-options-body {
  width: calc(300% + 2 * var(--viewer-action-gap));
  margin-block-start: var(--viewer-action-gap);
  margin-inline-start: calc(-200% - 2 * var(--viewer-action-gap));
  padding-inline: 10px;
  border: 1px solid var(--viewer-line);
  border-radius: 8px;
  background: var(--viewer-control);
}

.video-viewer .video-viewer-options-body > :is(a, button),
.video-viewer .video-viewer-options-body > details > summary {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  min-height: 44px;
  padding-block: 8px;
  text-align: start;
  white-space: normal;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.video-viewer .video-viewer-options-body > :not([hidden]) ~ :not([hidden]) {
  border-top: 1px solid var(--viewer-line);
}

.video-viewer-actions :is(.video-share-status, .video-share-link, .video-viewer-recovery) { grid-column: 1 / -1; }

.video-viewer :is(.video-viewer-close, .video-viewer-actions :is(a, button, summary, input)):focus-visible {
  outline: 2px solid var(--viewer-focus);
  outline-offset: 2px;
}

/* Immediate touch feedback keeps the existing control size and playback state. */
.video-viewer :is(.video-viewer-close, .video-viewer-actions :is(a, button, summary)):not(:disabled):active {
  border-color: var(--viewer-focus);
  background: var(--viewer-control);
  box-shadow: inset 0 0 0 1px var(--viewer-focus);
}

@media (hover: hover) {
  .video-viewer :is(.video-viewer-close, .video-viewer-actions :is(a, button, summary)):hover {
    box-shadow: inset 0 0 0 1px var(--viewer-focus);
  }
}

@media (forced-colors: active) {
  .video-viewer :is(.video-viewer-close, .video-viewer-actions :is(a, button, summary)):not(:disabled):active {
    border-color: Highlight;
    box-shadow: none;
  }
}
