/*
 * Floating "YouTube 公開中" ball (SPEC §2.15, TOP only). Values from
 * tokens.css only.
 *
 * HTML contract
 *   <a class="youtube-ball"
 *      href="https://www.youtube.com/@SunMusicGolfChannel">
 *     <img class="youtube-ball__image" src="../../assets/img/youtube/ball.webp"
 *          width="302" height="322"
 *          alt="YouTube 公開中 SUN MUSIC GOLF CHANNEL">
 *   </a>
 *   - A link: it goes to the channel (ASSUMPTION Q19, same URL and same tab
 *     as the YouTube block's button, Q36 / Q69). The bitmap holds all the
 *     text, so the alt repeats it and is the link's name (label in name).
 *   - TOP puts it as the last child of the NEWS section, where it is drawn
 *     in the first viewport, so it sits in a landmark and is reached after
 *     the news. No JS.
 *
 * XD (グループ 2165 on TOP PC and SP, meta.ux.fixed = fixed to the
 * viewport, not to the NEWS block as the earlier SPEC proposal said):
 *   PC  171×182, 77 from the right, 8 from the bottom (1080 viewport).
 *   SP  108×116, centred, 27 from the bottom (844 viewport; XD pins it to
 *       the top at y 701, ASSUMPTION Q72: bottom, so short phones show it).
 *   Shadow: 楕円形 16, an unfilled ellipse behind the sphere with the
 *   shadow-float drop shadow. XD paints it as a blurred filled ellipse, so
 *   ::before is that ellipse, blurred and moved 3 down, under the image.
 *   Size fluid 390 → 1920; the PC placement from 1024 (ASSUMPTION Q72).
 *
 * States are ASSUMPTION (SPEC §2.15, Q4): hover rotates −8° and scales to
 * 1.05 on hover-capable pointers; active = hover look + 1px down; focus =
 * the base ring, rounded to the ball's oval. Centring uses `translate`, the
 * states `rotate` / `scale`, so they combine without repeating each other.
 */

.youtube-ball {
  position: fixed;
  inset-block-end: var(--youtube-ball-inset-block);
  inset-inline-start: 50%;
  z-index: var(--z-youtube-ball);
  display: block;
  inline-size: var(--youtube-ball-width);
  block-size: var(--youtube-ball-height);
  border-radius: var(--radius-circle);
  translate: -50% 0;
  transition:
    rotate var(--duration-hover),
    scale var(--duration-hover),
    translate var(--duration-hover);
}

/* The sphere's shadow (XD 楕円形 16), under the image */
.youtube-ball::before {
  position: absolute;
  inset-block-start: var(--youtube-ball-sphere-block-start);
  inset-inline-start: var(--youtube-ball-sphere-inline-start);
  inline-size: var(--youtube-ball-sphere-inline-size);
  block-size: var(--youtube-ball-sphere-block-size);
  content: "";
  background-color: var(--youtube-ball-shadow-color);
  border-radius: var(--radius-circle);
  filter: blur(var(--youtube-ball-shadow-blur));
  translate: 0 var(--youtube-ball-shadow-offset);
}

.youtube-ball__image {
  position: relative;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

@media (width >= 1024px) {
  .youtube-ball {
    inset-block-end: var(--youtube-ball-inset-block-pc);
    inset-inline: auto var(--youtube-ball-inset-inline-pc);
    translate: 0 0;
  }
}

/* ---- States ---- */

@media (hover: hover) {
  .youtube-ball:hover {
    rotate: var(--youtube-ball-hover-rotate);
    scale: var(--youtube-ball-hover-scale);
  }
}

.youtube-ball:active {
  rotate: var(--youtube-ball-hover-rotate);
  scale: var(--youtube-ball-hover-scale);
  translate: -50% var(--press-offset);
}

@media (width >= 1024px) {
  .youtube-ball:active {
    translate: 0 var(--press-offset);
  }
}

@media print {
  .youtube-ball {
    display: none;
  }
}
