/*
 * Print styles.
 *
 * Enqueued last with media="print", so nothing here affects screen rendering.
 * Reveal effects are excluded from print at the source by scoping reveal.css to screen.
 */

/*--------------------------------------------------------------
# Page
--------------------------------------------------------------*/
@page {
  margin: 15mm;
}

/*
 * Scale the whole print 25% down. Theme font sizes and spacing are rem-based,
 * so shrinking the root size keeps typography and rhythm proportional.
 */

html {
  font-size: 75%;
}

html,
body {
  background: #fff !important;
  color: #000;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  break-after: avoid;
}

img,
svg,
figure,
tr,
blockquote {
  break-inside: avoid;
}

/*--------------------------------------------------------------
# Hidden elements
--------------------------------------------------------------*/

.wp-site-blocks > header.wp-block-template-part,
.wp-site-blocks > footer,
.menu-floating-bar,
.main-header,
.wp-block-cimcorp-anchor-links-container,
.wp-block-cimcorp-anchor-links,
main > .wp-block-group:has(.filter-related-posts-post-template),
.gform_wrapper,
.content-gate-form__divider,
.content-gate-form__intro,
.content-gate-form__form,
#CybotCookiebotDialog,
#CybotCookiebotDialogBodyUnderlay,
#CookiebotWidget,
.wp-block-cover__video-background,
.cover-video-toggle {
  display: none !important;
}

/* Fixed blurred backdrop behind the floating bar. */

.wp-site-blocks::before {
  display: none !important;
}

/*--------------------------------------------------------------
# Accordions
--------------------------------------------------------------*/

/* Core closes panels with hidden="until-found"; print every panel open. */

.wp-block-accordion-panel {
  display: block !important;
  content-visibility: visible !important;
}

.wp-block-accordion-heading__toggle-icon {
  display: none !important;
}

/*--------------------------------------------------------------
# Backgrounds
--------------------------------------------------------------*/

/*
 * Every coloured background or gradient is removed, and all text prints black,
 * so light sections simply lose their fill and dark sections stay legible.
 */

/* :root:root outranks WordPress' !important preset classes such as .has-*-color. */

:root:root,
:root:root *,
:root:root *::before,
:root:root *::after {
  color: #000 !important;
}

.has-background,
[class*="-background-color"],
[class*="-gradient-background"],
.wp-block-cover,
.wp-block-cover__background,
.wp-block-cover__gradient-background {
  background-color: transparent !important;
  background-image: none !important;
}

/* Cover overlays and background images would otherwise sit behind black text. */

.wp-block-cover__background,
.wp-block-cover__gradient-background,
.wp-block-cover__image-background {
  display: none !important;
}

.wp-block-cover {
  min-height: 0 !important;
}

/* Keep badges and filled buttons recognisable without their fill. */

.wp-block-button:not([class*="is-style-arrow-link"]) .wp-block-button__link,
.wp-block-query-title.has-background,
.wp-block-post-terms.has-background {
  border: 1px solid #000 !important;
  background: transparent !important;
  color: #000 !important;
}

/* Gate excerpt fade ends on white instead of the section background. */

.content-gate-form__excerpt::after {
  background: linear-gradient(transparent, #fff) !important;
}

/*--------------------------------------------------------------
# Video placeholders
--------------------------------------------------------------*/

/*
 * 16:9 is the floor; core's ratio ::before (wp-embed-aspect-*) can still make taller
 * embeds such as 4:3 grow to their own ratio when core embed styles are loaded.
 */

.wp-block-embed.is-type-video .wp-block-embed__wrapper {
  position: relative;
  aspect-ratio: 16 / 9;
  border: 1px solid #000;

  > * {
    display: none !important;
  }

  &::after {
    content: "Video";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
  }
}

.wp-block-video {

  > video {
    display: none !important;
  }

  &::before {
    content: "Video";
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 9;
    border: 1px solid #000;
    color: #000;
  }
}
