/* The how-to video's player (src/tutorial-player.js) in the style of the demo's panel (style.css tokens): a slim bar of
   the panel's grey above the video, with a dimmed title (pressing it moves the player) and dimmed buttons; the same
   border, corners and shadow as the panel; nothing around the video itself.  Over the page at its bottom right;
   minimized, the bar alone; in windows up to 720 px wide docked at the top of the page.  The demo behind it stays
   usable. */
.tutorial-player {
  box-sizing: border-box;
  position: fixed;
  z-index: 1000;
  width: 540px;
  max-width: 100%;
  margin: 0;
  padding: 0;
  /* a little darker than the panel's: the video's own edges are as light as the page */
  border: 1px solid rgb(var(--ink-rgb) / 0.14);
  border-radius: 16px;
  background: var(--panel-bg);
  color: var(--ink);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  overflow: hidden;
  font-family: inherit;
}
.tutorial-player *, .tutorial-player *::before, .tutorial-player *::after { box-sizing: border-box; }
.tutorial-player video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #000;
}

/* the bar: a shade darker than the video's light edge, so the two do not run together */
.tutorial-player-heading {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 32px;
  padding: 0 4px 0 0;
  background: rgb(var(--ink-rgb) / 0.05);
}
.tutorial-player button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgb(var(--ink-rgb) / 0.45);
  font: inherit;
  cursor: pointer;
  transition: background-color var(--quick), color var(--quick);
}
/* highlighted under a mouse only (a touch screen would keep it after a tap) */
@media (hover: hover) {
  .tutorial-player button:hover:not(:disabled) { background: rgb(var(--ink-rgb) / 0.07); color: var(--ink); }
}
.tutorial-player button:disabled { opacity: 0.35; cursor: default; }
/* inside the player's edge (it clips what is outside) */
.tutorial-player button:focus-visible, .tutorial-player a:focus-visible { outline-offset: -2px; }
.tutorial-player button svg { width: 14px; height: 14px; flex: none; }
/* the title: the whole rest of the bar, which moves the player */
.tutorial-player button[data-player-move] {
  flex: 1;
  min-width: 0;
  height: 100%;
  justify-content: flex-start;
  gap: 6px;
  padding: 0 8px 0 12px;
  border-radius: 0;
  color: var(--faint);
  cursor: grab;
  touch-action: none;
  user-select: none;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
}
@media (hover: hover) {
  .tutorial-player button[data-player-move]:hover { background: transparent; color: var(--faint); }
}
.tutorial-player [data-player-move] span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tutorial-player [data-player-move] svg { display: none; }
.tutorial-player.is-dragging [data-player-move] { cursor: grabbing; }
/* docked, it is not moved (the script disables it): shown as it is */
.tutorial-player [data-player-move]:disabled { opacity: 1; cursor: default; }

/* the failure message under the video */
.tutorial-player [data-player-error] {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px 12px;
  line-height: 1.4;
}
.tutorial-player [data-player-error] p { flex: 1 1 100%; margin: 0; }
/* the page's outlined buttons (style.css #city-button) */
.tutorial-player [data-player-error] button {
  width: auto;
  height: var(--ctl-h);
  padding: 0 10px;
  border: 1px solid rgb(var(--ink-rgb) / 0.14);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  font-weight: 600;
}
@media (hover: hover) {
  .tutorial-player [data-player-error] button:hover { border-color: rgb(var(--ink-rgb) / 0.35); }
}
.tutorial-player [data-player-error] a { color: var(--ink); font-weight: 500; }

/* minimized: the bar alone */
.tutorial-player .tutorial-expand-icon { display: none; }
.tutorial-player.is-collapsed video, .tutorial-player.is-collapsed [data-player-error],
.tutorial-player.is-collapsed .tutorial-collapse-icon { display: none; }
.tutorial-player.is-collapsed .tutorial-expand-icon { display: block; }

.tutorial-player[data-layout="inline"] {
  position: relative;
  inset: auto;
  grid-column: 1 / -1;
  grid-row: auto;
  width: 100%;
  z-index: auto;
  box-shadow: none;
}
/* docked: across the top of the page, the page below it (style.css #stage) */
.tutorial-player[data-layout="dock"] {
  top: 0;
  left: 0;
  width: 100%;
  border-width: 0 0 1px;
  border-radius: 0;
  box-shadow: none;
}
.tutorial-player[data-layout="dock"] video { max-height: 38dvh; }
.tutorial-player:not([data-layout="floating"]) [data-player-move] { cursor: default; }
/* touch screens and narrow windows: larger buttons */
@media (max-width: 720px), (pointer: coarse) {
  .tutorial-player-heading { height: 44px; }
  .tutorial-player button { width: 40px; height: 40px; }
  .tutorial-player button svg { width: 16px; height: 16px; }
}
