/* "Listen to this page" read-aloud control.
   Markup: src/_includes/partials/page-reader.njk
   Behaviour: src/js/page-reader.js
   A quiet byline under the page's h1: small muted text-style buttons, no
   box. It follows the heading's own alignment. Colour follows the banner
   it sits on: the site's muted text (--text-secondary) on light
   backgrounds, the banner sub-heading's light tone on the plum
   #inside-header, and the microsite sub-heading grey (#555) on the
   microsites' light banner, where --text-secondary would fall under 4.5:1. */

.page-reader[hidden],
.page-reader [hidden] {
  display: none !important;
}

.page-reader {
  display: block;
  margin-top: 0.375rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-secondary, #6c757d);
  text-align: inherit;
}

/* Same tone as the banner's sub-heading (.hp-section-sub); at least 4.8:1
   across the whole gradient. */
#inside-header .page-reader {
  color: rgba(255, 255, 255, 0.92);
}

body.microsite #inside-header .page-reader {
  color: #555;
}

.page-reader-btn {
  display: inline-block;
  min-height: 24px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  line-height: 24px;
  vertical-align: baseline;
  cursor: pointer;
}

.page-reader-btn:hover .page-reader-label,
.page-reader-btn:focus-visible .page-reader-label {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* The global focus ring is plum; on the plum banner it is drawn in white
   so it stays visible. */
#inside-header .page-reader-btn:focus-visible {
  outline-color: #fff;
}
body.microsite #inside-header .page-reader-btn:focus-visible {
  outline-color: var(--primary-color);
}

.page-reader-sep {
  margin: 0 0.5em;
}

.page-reader-note {
  margin: 0;
  font-size: inherit;
  color: inherit;
}

/* The block being read: a soft brand tint plus a bar on its left, drawn
   with box-shadow so the text never moves. */
.page-reader-current {
  background-color: rgba(82, 63, 67, 0.12);
  background-color: color-mix(in srgb, var(--primary-color) 12%, transparent);
  box-shadow: -6px 0 0 0 rgba(82, 63, 67, 0.12), -10px 0 0 0 var(--primary-color);
  box-shadow: -6px 0 0 0 color-mix(in srgb, var(--primary-color) 12%, transparent), -10px 0 0 0 var(--primary-color);
  border-radius: 2px;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

/* Phones: grow each control's hit area from 24px to 44px tall. The equal
   negative margin keeps the byline exactly where it sits today. */
@media (max-width: 767.98px) {
  .page-reader-btn {
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
    margin-top: -0.625rem;
    margin-bottom: -0.625rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-reader-current {
    transition: none;
  }
}

@media print {
  .page-reader {
    display: none !important;
  }
  .page-reader-current {
    background-color: transparent;
    box-shadow: none;
  }
}
