/* ==========================================================================
   Voorlezen (text-to-speech) — D'End 24
   Trigger in menu + vaste bedieningsbalk onderaan + tekst-highlight.
   ========================================================================== */

:root {
  --vl-green: #23ccb3;
  --vl-green-dark: #1aa893;
  --vl-ink: #151035;
}

/* --- Icoon (svg-bestanden; 2 standen: volume / volume-2) ---------------- */
.vl-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  vertical-align: middle;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url(../images/volume.svg); /* rust: geen golf */
}

/* --- Trigger: desktop menu (naast zoek-icoon) --------------------------- */
.main-menu__voorlezen {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  /* Groter klik-/raakvlak (~44px) voor toegankelijkheid; padding is constant
     (ook in rust) zodat het menu niet verschuift bij klik. */
  padding: 10px;
  margin-left: calc(1rem - 10px);
  cursor: pointer;
  line-height: 0;
}
/* Hover of tijdens lezen: volle golven (volume-2) */
.main-menu__voorlezen:hover .vl-icon,
.main-menu__voorlezen:focus-visible .vl-icon,
.main-menu__voorlezen.is-active .vl-icon {
  background-image: url(../images/volume-2.svg);
}

/* --- Trigger: mobiel menu (witte versie op donkere achtergrond) --------- */
.mobile-menu__voorlezen {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  gap: .5rem;
  width: 100%;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
}
.mobile-menu__voorlezen .vl-icon {
  width: 22px;
  height: 22px;
  background-image: url(../images/volume-white.svg);
}
.mobile-menu__voorlezen:hover .vl-icon,
.mobile-menu__voorlezen:focus-visible .vl-icon,
.mobile-menu__voorlezen.is-active .vl-icon {
  background-image: url(../images/volume-2-white.svg);
}

/* --- Bedieningsbalk onderaan -------------------------------------------- */
.voorlezen-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9990; /* onder search-overlay (9999) */
  background: #fff;
  border-top: 4px solid var(--vl-green);
  -webkit-box-shadow: 0 -4px 18px rgba(0, 0, 0, .14);
          box-shadow: 0 -4px 18px rgba(0, 0, 0, .14);
  -webkit-transform: translateY(110%);
          transform: translateY(110%);
  -webkit-transition: -webkit-transform .25s ease;
  transition: -webkit-transform .25s ease;
  transition: transform .25s ease;
}
.voorlezen-bar.is-active {
  -webkit-transform: translateY(0);
          transform: translateY(0);
}

.voorlezen-bar__inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: .85rem 1.25rem;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: justify;
      -ms-flex-pack: justify;
          justify-content: space-between;
  gap: 1rem;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
}

.voorlezen-bar__status {
  font-size: 18px;
  font-weight: 600;
  color: var(--vl-ink);
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  gap: .5rem;
}
.voorlezen-bar__status::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--vl-green);
  -webkit-animation: vl-pulse 1.2s ease-in-out infinite;
          animation: vl-pulse 1.2s ease-in-out infinite;
}
.voorlezen-bar.is-flash .voorlezen-bar__status::before {
  -webkit-animation: none;
          animation: none;
  background: #c0392b;
}

@-webkit-keyframes vl-pulse {
  0%, 100% { opacity: 1; -webkit-transform: scale(1); transform: scale(1); }
  50% { opacity: .35; -webkit-transform: scale(.7); transform: scale(.7); }
}
@keyframes vl-pulse {
  0%, 100% { opacity: 1; -webkit-transform: scale(1); transform: scale(1); }
  50% { opacity: .35; -webkit-transform: scale(.7); transform: scale(.7); }
}

.voorlezen-bar__controls {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  gap: .6rem;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
}

.voorlezen-bar__btn {
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  border: 2px solid var(--vl-green);
  background: #fff;
  color: var(--vl-ink);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  padding: 0 1.1rem;
  min-height: 48px; /* groot raakvlak */
  border-radius: 999px;
  cursor: pointer;
  -webkit-transition: background .15s ease, color .15s ease;
  transition: background .15s ease, color .15s ease;
}
.voorlezen-bar__btn:hover,
.voorlezen-bar__btn:focus-visible {
  background: var(--vl-green);
  color: #fff;
}
.voorlezen-bar__btn--pause {
  background: var(--vl-green);
  color: #fff;
}
.voorlezen-bar__btn--pause:hover,
.voorlezen-bar__btn--pause:focus-visible {
  background: var(--vl-green-dark);
}
.voorlezen-bar__btn--stop {
  border-color: #c0392b;
  color: #c0392b;
}
.voorlezen-bar__btn--stop:hover,
.voorlezen-bar__btn--stop:focus-visible {
  background: #c0392b;
  border-color: #c0392b;
  color: #fff;
}

.voorlezen-bar__rate {
  min-width: 3.2em;
  text-align: center;
  font-weight: 600;
  color: var(--vl-ink);
}

/* Duidelijke focus-indicatie (toegankelijkheid). */
.voorlezen-bar__btn:focus-visible,
.main-menu__voorlezen:focus-visible,
.mobile-menu__voorlezen:focus-visible {
  outline: 3px solid var(--vl-green-dark);
  outline-offset: 2px;
}

/* --- Highlight van de zin/alinea die wordt voorgelezen ------------------ */
.voorlezen-highlight {
  background: rgba(35, 204, 179, .22);
  -webkit-box-shadow: 0 0 0 4px rgba(35, 204, 179, .22);
          box-shadow: 0 0 0 4px rgba(35, 204, 179, .22);
  border-radius: 4px;
  -webkit-transition: background .2s ease;
  transition: background .2s ease;
}

/* Zorg dat content niet achter de balk verdwijnt wanneer die actief is. */
body.vl-bar-open {
  padding-bottom: var(--vl-bar-height, 112px);
}

/* --- Mobiel ------------------------------------------------------------- */
@media (max-width: 600px) {
  .voorlezen-bar__inner {
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
        -ms-flex-direction: column;
            flex-direction: column;
    -webkit-box-align: stretch;
        -ms-flex-align: stretch;
            align-items: stretch;
    gap: .6rem;
    padding: .75rem 1rem;
  }
  .voorlezen-bar__controls {
    -webkit-box-pack: center;
        -ms-flex-pack: center;
            justify-content: center;
  }
  .voorlezen-bar__btn {
    -webkit-box-flex: 1;
        -ms-flex: 1 1 auto;
            flex: 1 1 auto;
    text-align: center;
  }
}

/* Respecteer voorkeur voor minder beweging. */
@media (prefers-reduced-motion: reduce) {
  .voorlezen-bar,
  .voorlezen-bar__status::before {
    -webkit-transition: none;
    transition: none;
    -webkit-animation: none;
            animation: none;
  }
}
