:root {
  --mav-def-accent: #002BAB;
  --mav-def-text: #171717;
  --mav-def-muted: #5f5f5f;
  --mav-def-bg: #fff;
  --mav-def-border: #e6e6e6;
  --mav-def-shadow: 0 12px 35px rgba(0,0,0,.18);
}

.mav-def {
  position: relative;
  display: inline !important;
  white-space: normal;
}

/* VRT-achtige focuslaag. De popover wordt in een aparte portallaag
   rechtstreeks onder body geplaatst en blijft daardoor altijd scherp. */
.mav-def__backdrop {
  position: fixed;
  inset: 0;
  z-index: 2147483400;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .16s ease, visibility 0s linear .16s;
}

body.mav-definition-open .mav-def__backdrop,
.mav-def__backdrop.is-visible {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.mav-def__portal {
  position: fixed;
  inset: 0;
  z-index: 2147483600;
  pointer-events: none;
  isolation: isolate;
  filter: none !important;
}

.mav-def__portal .mav-def__popover.is-portal-open {
  position: fixed !important;
  z-index: 1 !important;
  right: auto !important;
  bottom: auto !important;
  margin: 0 !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: auto;
  transform: none !important;
  transition: opacity .14s ease, visibility 0s linear .14s;
}

.mav-def__portal .mav-def__popover.is-portal-open.is-positioned {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.mav-def__portal .mav-def__popover.is-portal-open:before {
  display: none;
}

.mav-def__trigger {
  appearance: none !important;
  -webkit-appearance: none !important;
  display: inline !important;
  vertical-align: baseline !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: 0 !important;
  color: var(--mav-def-accent) !important;
  font: inherit !important;
  line-height: inherit !important;
  text-align: inherit !important;
  text-transform: none !important;
  letter-spacing: inherit !important;
  cursor: help;
}

.mav-def__label {
  display: inline;
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1.5px;
  text-underline-offset: .18em;
}

@media (hover: hover) and (pointer: fine) {
  .mav-def__trigger:focus-visible .mav-def__label {
    outline: 2px solid var(--mav-def-accent);
    outline-offset: 3px;
    border-radius: 3px;
  }
}

.mav-def__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.52em;
  min-width: 1.52em;
  height: 1.52em;
  margin-left: .28em;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  color: var(--mav-def-accent);
  font-size: 0.65em;
  font-weight: 700;
  line-height: 1;
  transform: translateY(-.18em);
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
  text-decoration: none !important;
}

.mav-def__icon--large {
  width: 18px;
  min-width: 18px;
  height: 18px;
  margin: 0 8px 0 0;
  font-size: 11px;
  flex: 0 0 18px;
  transform: none;
}

.mav-def__popover {
  position: absolute;
  z-index: 2147483647;
  left: 50%;
  bottom: calc(100% + 12px);
  width: max-content;
  min-width: 220px;
  max-width: min(420px, calc(100vw - 32px));
  transform: translateX(-50%) translateY(4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: var(--mav-def-bg);
  color: var(--mav-def-text);
  border: 1px solid var(--mav-def-border);
  border-radius: 10px;
  box-shadow: var(--mav-def-shadow);
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.45;
  transition: opacity .16s ease, transform .16s ease, visibility 0s linear .16s;
}

.mav-def__popover:before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 14px;
  height: 14px;
  background: var(--mav-def-bg);
  border-right: 1px solid var(--mav-def-border);
  border-bottom: 1px solid var(--mav-def-border);
  transform: translateX(-50%) rotate(45deg);
}

.mav-def.is-open .mav-def__popover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  transition-delay: 0s;
}

.mav-def__head {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  color: var(--mav-def-text);
}

.mav-def__body { display: block; white-space: normal; }

.mav-def__more {
  display: inline-block;
  margin-top: 10px;
  color: var(--mav-def-accent);
  font-weight: 700;
  text-decoration: none;
}

/* Alleen op touchtoestellen krijgt de achtergrond een subtiele focusblur.
   Op desktop blijft de pagina volledig scherp. */
@media (hover: none), (pointer: coarse) {
  .mav-def__backdrop {
    background: rgba(255, 255, 255, .18);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
  }
}

@media (hover: none), (pointer: coarse), (max-width: 1024px) {
  body.mav-definition-open {
    overflow: hidden;
    overscroll-behavior: contain;
  }

  .mav-def__portal .mav-def__popover.is-portal-open {
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
  }

  .mav-def__trigger {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .mav-def__trigger:focus,
  .mav-def__trigger:active,
  .mav-def__trigger:focus-visible,
  .mav-def__label:focus,
  .mav-def__label:active {
    outline: 0 !important;
    box-shadow: none !important;
  }

  .mav-def__popover {
    position: fixed !important;
    z-index: 2147483647 !important;
    left: 50% !important;
    top: 50% !important;
    bottom: auto !important;
    width: max-content;
    min-width: 220px;
    max-width: calc(100vw - 40px);
    max-height: calc(100svh - 120px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    transform: translate(-50%, -50%) !important;
    transition: opacity .12s ease, visibility 0s linear .12s;
  }

  .mav-def__popover:before { display: none; }

  .mav-def.is-open .mav-def__popover {
    transform: translate(-50%, -50%) !important;
  }
}

/* Reading experience */
.mav-reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 2147483000;
  pointer-events: none;
  background: transparent;
}

body.admin-bar .mav-reading-progress { top: 32px; }

.mav-reading-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--mav-def-accent);
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}

.mav-reading-info {
  display: block;
  margin: 0 0 24px;
  color: var(--mav-def-muted);
  font-size: 14px;
  line-height: 1.4;
}

.mav-toc {
  position: fixed;
  top: clamp(96px, 14vh, 132px);
  left: max(24px, calc((100vw - 1180px) / 2 - 340px));
  right: auto;
  width: 310px;
  max-height: calc(100vh - clamp(150px, 24vh, 220px));
  overflow: auto;
  z-index: 40;
  padding: 2px 0 2px 18px;
  border-left: 1px solid rgba(0,0,0,.1);
  background: transparent;
  color: var(--mav-def-text);
  font-size: 14px;
  text-wrap: balance;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .12s ease, visibility 0s linear .12s;
  line-height: 1.25;
}

body.mav-toc-visible .mav-toc {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.mav-toc__title { display: none !important; }

.mav-toc ol,
.mav-mobile-toc ol {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.mav-toc li,
.mav-mobile-toc li {
  margin: 0 !important;
  padding: 0 !important;
}

.mav-toc a {
  position: relative;
  display: block;
  padding: 8px 0;
  color: var(--mav-def-muted);
  font-weight: 400;
  text-decoration: none !important;
  transition: color .15s ease;
  overflow-wrap: normal;
  word-break: normal;
  line-height: 17px;
}

.mav-toc a::after {
  content: attr(data-mav-label);
  display: block;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-weight: 400;
  pointer-events: none;
}

.mav-toc a:before {
  content: "";
  position: absolute;
  left: -19px;
  top: 5px;
  bottom: 5px;
  width: 3px;
  border-radius: 999px;
  background: transparent;
}

.mav-toc a:hover,
.mav-toc a.is-active {
  color: var(--mav-def-accent);
}

.mav-toc a.is-active {
  font-weight: 400;
}

.mav-toc a.is-active:before {
  background: var(--mav-def-accent);
}

.mav-mobile-toc {
  display: none;
  margin: 0 0 28px;
  border: 1px solid var(--mav-def-border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.mav-mobile-toc__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 13px 15px;
  border: 0;
  background: #fff;
  color: var(--mav-def-text);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.mav-mobile-toc__toggle:after {
  content: "";
  display: block;
  width: .55em;
  height: .55em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .15s ease;
}

.mav-mobile-toc.is-open .mav-mobile-toc__toggle:after {
  transform: rotate(-135deg) translateY(-1px);
}

.mav-mobile-toc__panel {
  display: none;
  padding: 0 15px 13px;
}

.mav-mobile-toc.is-open .mav-mobile-toc__panel { display: block; }

.mav-mobile-toc a {
  display: block;
  padding: 8px 0;
  color: var(--mav-def-muted);
  font-weight: 400;
  text-decoration: none !important;
}

.mav-mobile-toc a.is-active {
  color: var(--mav-def-accent);
  font-weight: 400;
}

.mav-anchor-heading {
  scroll-margin-top: 100px;
}

.mav-heading-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: .35em;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--mav-def-accent);
  font: inherit;
  font-size: .75em;
  line-height: 1;
  opacity: 0;
  cursor: pointer;
  text-decoration: none !important;
  transition: opacity .15s ease;
}

.mav-heading-link { display: none !important; }

.mav-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 2147483647;
  transform: translateX(-50%) translateY(8px);
  opacity: 0;
  pointer-events: none;
  background: var(--mav-def-text);
  color: #fff;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 14px;
  line-height: 1.2;
  transition: opacity .15s ease, transform .15s ease;
}

.mav-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* Hide the left table of contents when the viewport is too narrow.
   This prevents overlap with the article content when the browser is scaled down. */
@media (max-width: 1680px) {
  .mav-toc { display: none !important; }
  body.mav-toc-visible .mav-toc { display: none !important; }
}

@media (max-width: 1024px) {
  .mav-toc,
  .mav-mobile-toc { display: none !important; }
}

@media (max-width: 782px) {
  body.admin-bar .mav-reading-progress { top: 46px; }
  .mav-reading-progress { height: 3px; }
  .mav-reading-info { margin-bottom: 18px; }
  .mav-anchor-heading { scroll-margin-top: 80px; }
  .mav-heading-link { display: none !important; }
}

.mav-reading-info { display: none !important; }

/* No generated anchor/hash buttons next to headings. */
.mav-anchor-heading .mav-heading-link,
.mav-anchor-heading > a[href^="#"]:last-child,
.mav-anchor-heading > button:last-child {
  display: none !important;
}

.mav-toc a.is-active,
.mav-toc a:active,
.mav-toc a:focus {
  font-weight: 400 !important;
  color: var(--mav-def-accent) !important;
}

/* Extra vangnet voor oudere anchor buttons naast H2's. */
h2 .mav-heading-link,
h2 a.mav-heading-link,
h2 > a[href^="#"]:last-child,
h2 > button:last-child,
h2 > .elementor-button-wrapper:last-child,
h2 > .elementor-button:last-child,
h2 > span:last-child:is(.mav-heading-link) {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .mav-def__backdrop {
    transition: none;
  }
}
