/* The article's YouTube video (embed-float.js): plays muted without YouTube's title, controls or
   "Watch on YouTube", and moves to the bottom-right corner once the reader scrolls past it. */

/* YouTube still draws its title bar at the top of the player and its logo at the bottom. The iframe
   is made 400px taller than the box and centred, so those bars fall outside the box while the video
   (which YouTube fits to the iframe's width) fills it exactly. */
.wp-block-embed .tp-embed-box { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #000; }
.wp-block-embed .tp-embed-box::before { display: none !important; }
.wp-block-embed .tp-embed-box iframe {
  /* !important: the theme's responsive-embed rules and script size embeds to their box */
  position: absolute !important; left: 0 !important; top: 50% !important; width: 100% !important; height: calc(100% + 400px) !important;
  max-width: none !important; max-height: none !important; transform: translateY(-50%); border: 0; pointer-events: none; /* no YouTube pause/replay overlay on click */
}

/* "Tap for sound" while muted; once the sound is on, the speaker in the control bar takes over */
.tp-embed-box .tp-embed-sound {
  position: absolute; left: 12px; bottom: 12px; z-index: 2; display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px 8px 10px; border: 0; border-radius: 999px; background: rgb(255 255 255 / .95); color: #010145; cursor: pointer;
  font-family: var(--cs-font-secondary-family), sans-serif; font-size: 12px; font-weight: 700; line-height: 1; box-shadow: 0 6px 20px rgb(0 0 0 / .3);
  transition: opacity .2s;
}
.tp-embed-box .tp-embed-sound:hover,
.tp-embed-box .tp-embed-sound:focus-visible { background: #fff; color: #010145; }
.tp-embed-box.tp-sound-on .tp-embed-sound { display: none; }
.tp-embed-box button svg { display: block; flex: none; opacity: 1; }

/* paused: the thumbnail with a play button covers YouTube's own paused screen */
.tp-embed-box .tp-embed-cover {
  position: absolute; inset: 0; z-index: 1; display: none; place-items: center; padding: 0; border: 0; border-radius: 0; cursor: pointer;
  background-color: #000; background-size: cover; background-position: center;
}
.tp-embed-box.tp-paused .tp-embed-cover { display: grid; }
.tp-embed-cover span { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; background: rgb(255 255 255 / .95); color: #010145; box-shadow: 0 8px 24px rgb(0 0 0 / .35); }
.tp-embed-cover span svg { width: 22px; height: 22px; margin-left: 3px; }
.tp-embed-cover:hover span, .tp-embed-cover:focus-visible span { background: #fff; transform: scale(1.05); }

/* control bar: play/pause, sound, seek bar and time; on hover (or a tap on touch screens) */
.tp-embed-box .tp-embed-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; align-items: center; gap: 6px;
  padding: 28px 12px 10px; background: linear-gradient(0deg, rgb(0 0 0 / .7), transparent);
  opacity: 0; pointer-events: none; transition: opacity .2s;
  font-family: var(--cs-font-secondary-family), sans-serif;
}
.tp-embed-box:hover .tp-embed-bar, .tp-embed-box:focus-within .tp-embed-bar,
.tp-embed-box.tp-show-bar .tp-embed-bar, .tp-embed-box.tp-paused .tp-embed-bar { opacity: 1; pointer-events: auto; }
/* the bar takes the pill's place while it shows */
.tp-embed-box:hover .tp-embed-sound, .tp-embed-box:focus-within .tp-embed-sound,
.tp-embed-box.tp-show-bar .tp-embed-sound, .tp-embed-box.tp-paused .tp-embed-sound { opacity: 0; pointer-events: none; }
.tp-embed-bar button {
  width: 32px; height: 32px; flex: none; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: #fff; cursor: pointer;
}
.tp-embed-bar button:hover, .tp-embed-bar button:focus-visible { background: rgb(255 255 255 / .18); color: #fff; }
.tp-embed-time { flex: none; color: #fff; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* the theme styles every <input> as a white form field; this one is a plain slider */
.tp-embed-bar input.tp-embed-seek {
  --tp-pct: 0%; flex: 1; min-width: 40px; width: auto; height: 18px; min-height: 0; margin: 0 4px; padding: 0;
  border: 0 !important; border-radius: 0; box-shadow: none !important; background: transparent !important; outline: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.tp-embed-seek::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, #fff var(--tp-pct), rgb(255 255 255 / .35) var(--tp-pct)); }
.tp-embed-seek::-moz-range-track { height: 4px; border-radius: 2px; background: rgb(255 255 255 / .35); }
.tp-embed-seek::-moz-range-progress { height: 4px; border-radius: 2px; background: #fff; }
.tp-embed-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4px; border: 0; border-radius: 50%; background: #fff; }
.tp-embed-seek::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #fff; }
.tp-embed-seek:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 4px; }
@media (max-width: 600px) { .tp-embed-floating .tp-embed-time { display: none; } }

/* the corner player */
.tp-embed-box .tp-embed-x { display: none; }
.wp-block-embed .tp-embed-box.tp-embed-floating {
  position: fixed; right: 16px; bottom: 16px; z-index: 60; width: min(400px, calc(100vw - 32px));
  border-radius: 8px; box-shadow: 0 18px 50px rgb(0 0 0 / .35);
  animation: tp-embed-in .3s cubic-bezier(.2, .8, .2, 1);
}
@keyframes tp-embed-in { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
.tp-embed-box.tp-embed-floating .tp-embed-x {
  position: absolute; top: 8px; right: 8px; z-index: 2; display: grid; place-items: center;
  width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: rgb(0 0 0 / .55); color: #fff; cursor: pointer;
}
.tp-embed-box.tp-embed-floating .tp-embed-x:hover,
.tp-embed-box.tp-embed-floating .tp-embed-x:focus-visible { background: rgb(0 0 0 / .85); color: #fff; }
.tp-embed-box.tp-embed-floating .tp-embed-sound { left: 10px; bottom: 10px; }
.tp-embed-box.tp-embed-floating .tp-embed-x { z-index: 4; }

@media (max-width: 600px) {
  .wp-block-embed .tp-embed-box.tp-embed-floating { right: 8px; bottom: 8px; width: min(300px, calc(100vw - 16px)); }
}
@media (prefers-reduced-motion: reduce) { .wp-block-embed .tp-embed-box.tp-embed-floating { animation: none; } }

/* the theme's "back to top" button sits in the same corner: hidden while the video is there */
html.tp-embed-out .pk-scroll-to-top { opacity: 0 !important; pointer-events: none !important; }
/* while a video starts or resumes, its thumbnail hides YouTube's own (unclickable) buttons for a moment */
.tp-embed-box.tp-starting .tp-embed-cover { display: grid; pointer-events: none; }
.tp-embed-box.tp-starting:not(.tp-paused) .tp-embed-cover span { display: none; }
/* the video itself is clickable (pause / play) */
.tp-embed-box { cursor: pointer; }
