/*
 * Shims on top of the ported Publii "Mercury" theme stylesheet.
 * These apply site-wide (every post/page), not to any single entry.
 */

/*
 * Accessibility: the theme's coral (#FF6D5A) only hits 2.8:1 on white,
 * failing WCAG AA for text. Deepen the single accent colour site-wide to
 * #cf3c26 (4.85:1) — still coral, now legible. Affects links and every
 * accent that derives from --color / --link-color.
 */
:root {
  --color: #cf3c26;
  --color-rgb: 207, 60, 38;
  --link-color: #cf3c26;
}

/*
 * Markdown renders plain <p><img></p> instead of Publii's
 * <figure class="post__image post__image--center"> wrapper, so recreate
 * the centered-image look for images inside the post body.
 */
.content__entry img {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.content__entry figure img {
  margin-left: auto;
  margin-right: auto;
}

/*
 * Prev/next post links were <h5> in the Publii theme, which broke heading
 * order (h2 content -> h5). They're navigation links, not document
 * headings, so they're now <span class="content__nav__title"> — this
 * restores the theme's h5 look (arrows, spacing) on the new element.
 */
.content__nav__title {
  display: block;
  margin: 0.2666666667rem 0 0;
  text-transform: none;
}
.content__nav__prev > .content__nav__title > a {
  padding-left: 1.6rem;
  display: inline-block;
}
.content__nav__next > .content__nav__title > a {
  padding-right: 1.6rem;
  display: inline-block;
}
.content__nav__prev > .content__nav__title::before {
  content: "←";
  display: inline-block;
  height: 1rem;
  margin-right: 0.2666666667rem;
  position: absolute;
  top: 1.2rem;
  transition: all 0.12s linear 0s;
  transform: translateX(0);
  width: 1rem;
}
.content__nav__next > .content__nav__title::after {
  content: "→";
  display: inline-block;
  height: 1rem;
  margin-left: 0.2666666667rem;
  position: absolute;
  right: 0;
  top: 1.2rem;
  transition: all 0.12s linear 0s;
  transform: translateX(0);
  width: 1rem;
}
.content__nav__prev:hover .content__nav__title::before {
  color: var(--link-color);
  transform: translateX(-0.2666666667rem);
}
.content__nav__next:hover .content__nav__title::after {
  color: var(--link-color);
  transform: translateX(0.2666666667rem);
}
.content__nav__prev:hover .content__nav__title > a {
  padding-left: 1.8666666667rem;
}
.content__nav__next:hover .content__nav__title > a {
  padding-right: 1.8666666667rem;
}

/*
 * YouTube facade: markdown YouTube iframes are replaced (by
 * src/lib/rehype-youtube.mjs) with a lightweight click-to-load poster so
 * the ~3 MB YouTube player only loads when the visitor hits play.
 */
.yt-facade {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  margin: 0;
  background: #000;
  border-radius: var(--border-radius);
  overflow: hidden;
}
.yt-facade__btn {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  cursor: pointer;
  background: transparent;
}
.yt-facade__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.yt-facade__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 48px;
  border-radius: 14%;
  background: rgba(18, 18, 18, 0.8);
  transition: background 0.2s;
}
.yt-facade__play::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-40%, -50%);
  border-style: solid;
  border-width: 11px 0 11px 19px;
  border-color: transparent transparent transparent #fff;
}
.yt-facade__btn:hover .yt-facade__play,
.yt-facade__btn:focus-visible .yt-facade__play {
  background: var(--color);
}
.yt-facade iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
