/* Diboru enhancement layer. Additive: loads after site.css, touches no existing file, uses the theme's own colour
   variables (so dark mode just works). Delete mu-plugins/diboru-enhance.php to switch the whole layer off. */

/* ---- Typography: balanced headings, no one-word last lines ------------------------------------------------- */
h1, h2, h3, .v-phero__title, .v-h2 { text-wrap: balance; }
.d-prose p, .d-prose li, .d-faq details > :not(summary), .v-lead { text-wrap: pretty; }
.d-prose h2, .d-prose h3 { overflow-wrap: anywhere; }

/* ---- Phones: the sub-page heroes were 78vh tall, so the first screen was mostly empty gradient ------------- */
@media (max-width: 760px) {
  .v-phero .v-frame { min-height: clamp(340px, 54svh, 500px); }
}
@media (max-height: 520px) and (orientation: landscape) {
  .v-phero .v-frame { min-height: 0; }
  .d-legal__hero { padding-top: clamp(96px, 14vh, 120px); }
}

/* ---- Touch: 44px targets for the small links and icon buttons ---------------------------------------------- */
@media (pointer: coarse) {
  .v-footer__nav ul { gap: 0; }
  .v-footer__nav a, .v-footer__contact a, .v-footer .d-linkbtn { display: inline-flex; align-items: center; min-height: 44px; }
  .v-brand { min-width: 44px; min-height: 44px; }
  .v-iconbtn, .d-themebtn { min-width: 44px; min-height: 44px; }
}

/* ---- Long legal pages: table of contents, reading time, copy-link anchors ---------------------------------- */
.dx-read { margin: 14px 0 0; font-size: .95rem; color: var(--d-muted); }

.dx-toc { font-size: .95rem; margin: 0 0 28px; border: 1px solid var(--d-line); border-radius: 18px; background: var(--d-surface); }
.dx-toc > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; min-height: 48px; padding: 10px 18px; font-weight: 700; color: var(--d-heading); }
.dx-toc > summary::-webkit-details-marker { display: none; }
.dx-toc > summary::after { content: ""; width: 10px; height: 10px; border: solid currentColor; border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) translateY(-2px); transition: transform .2s; }
.dx-toc[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.dx-toc ol { margin: 0; padding: 4px 8px 12px; list-style: none; display: grid; gap: 2px; }
.dx-toc a { display: block; padding: 9px 12px; border-radius: 10px; color: var(--d-muted); text-decoration: none; line-height: 1.35; }
.dx-toc a:hover { color: var(--d-heading); background: var(--d-accent-soft); }
.dx-toc a[aria-current="true"] { color: var(--d-heading); font-weight: 700; background: var(--d-accent-soft); box-shadow: inset 3px 0 0 var(--d-accent); }
.dx-toc a:focus-visible { outline: 3px solid var(--d-accent); outline-offset: 1px; }

@media (min-width: 1100px) {
  .d-legal__body.dx-has-toc { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 56px; max-width: 1140px; align-items: start; }
  .d-legal__body.dx-has-toc > .d-prose { max-width: 800px; }
  .dx-toc { position: sticky; top: 108px; margin: 0; max-height: calc(100svh - 140px); overflow: auto; overscroll-behavior: contain; }
  .dx-toc > summary { cursor: default; pointer-events: none; }
  .dx-toc > summary::after { display: none; }
}

.d-prose :is(h2, h3) { position: relative; }
.dx-anchor { margin-left: .4em; font-weight: 600; text-decoration: none; opacity: 0; color: var(--d-accent); transition: opacity .15s; }
.d-prose :is(h2, h3):hover .dx-anchor, .dx-anchor:focus-visible { opacity: 1; }
@media (pointer: coarse) { .dx-anchor { display: none; } }

/* ---- FAQ: search, expand all, empty state ----------------------------------------------------------------- */
.dx-faq-tools { max-width: 820px; margin: 0 auto 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.dx-search { flex: 1 1 240px; position: relative; display: block; }
.dx-search input { width: 100%; min-height: 48px; padding: 0 18px 0 46px; border: 1px solid var(--d-line); border-radius: 999px;
  background: var(--d-surface); color: var(--d-text); font: inherit; font-size: 1rem; box-sizing: border-box; }
.dx-search input::placeholder { color: var(--d-muted); }
.dx-search input:focus-visible { outline: 3px solid var(--d-accent); outline-offset: 1px; border-color: var(--d-accent); }
.dx-search svg { position: absolute; left: 16px; top: 50%; width: 20px; height: 20px; margin-top: -10px; color: var(--d-muted); pointer-events: none; }
.dx-btn { min-height: 48px; padding: 0 20px; border: 1px solid var(--d-line); border-radius: 999px; background: var(--d-surface);
  color: var(--d-heading); font: inherit; font-weight: 700; cursor: pointer; }
.dx-btn:hover { border-color: var(--d-accent); }
.dx-btn:focus-visible { outline: 3px solid var(--d-accent); outline-offset: 2px; }
.dx-status { max-width: 820px; margin: 0 auto 12px; font-size: .95rem; color: var(--d-muted); min-height: 1.4em; }
.d-faq details[hidden] { display: none; }

/* ---- Back to top + copy toast ----------------------------------------------------------------------------- */
.dx-top { position: fixed; right: max(16px, 2.5vw); bottom: max(16px, 2.5vw); z-index: 40; width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--d-line); background: var(--d-surface); color: var(--d-heading); box-shadow: var(--d-shadow); cursor: pointer;
  display: grid; place-items: center; opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s, transform .2s; }
.dx-top.is-on { opacity: 1; transform: none; pointer-events: auto; }
.dx-top:focus-visible { outline: 3px solid var(--d-accent); outline-offset: 2px; }
.dx-top svg { width: 22px; height: 22px; }
.dx-toast { position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  padding: 12px 18px; border-radius: 999px; background: var(--d-heading); color: var(--d-bg); font-weight: 600; font-size: .95rem; transition: opacity .2s, transform .2s; }
.dx-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.dx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .dx-top, .dx-toast, .dx-toc > summary::after, .dx-anchor { transition: none; } }

/* ---- Printing the policy / FAQ: paper-friendly -------------------------------------------------------------- */
@media print {
  .v-header, .v-menu, .v-footer, .d-consent, .dx-toc, .dx-top, .dx-toast, .dx-faq-tools, .dx-status, .dx-anchor, .v-progress, .d-skip, .v-phero .v-mesh { display: none !important; }
  html, body { background: #fff !important; color: #000 !important; }
  .d-legal__hero, .v-phero .v-frame { background: none !important; margin: 0 !important; padding: 0 0 12pt !important; min-height: 0 !important; color: #000 !important; }
  .v-phero__title, .v-phero .v-eyebrow, .v-phero .v-lead { color: #000 !important; background: none !important; border: 0 !important; }
  .d-legal__body.dx-has-toc { display: block; max-width: none; padding: 0; }
  .d-prose a[href^="http"]::after, .d-prose a[href^="/"]::after { content: " (" attr(href) ")"; font-size: .85em; overflow-wrap: anywhere; }
  .d-prose h2, .d-prose h3 { break-after: avoid; }
  .d-faq details, .d-prose li { break-inside: avoid; }
  .d-faq details > :not(summary) { display: block !important; }
  .d-faq summary::after { display: none; }
}
