/* ==========================================================================
   Print
   ==========================================================================

   Loaded with media="print", so none of this touches the screen. The
   fourth stylesheet the framework enqueues, and the only one that is
   not also a screen stylesheet.

   What a printed page is for: reading away from the site. Everything
   that only works by being clicked is dead weight on paper -- menus,
   overlays, filters, a back-to-top button -- so it goes. Everything
   that carries information stays, including the destination of a link,
   which is the one thing printing normally throws away.

   The blanket rule below is the important one, and it is deliberately
   heavy-handed. This framework has a surfaces system: a block sets a
   surface and the text color comes with it, so a dark panel has white
   text on it. Strip the backgrounds for print without doing anything
   about the text and that panel prints white on white -- not faint, not
   ugly, gone. Forcing both halves at once is what makes that
   impossible rather than unlikely.
   ========================================================================== */

*,
*::before,
*::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;

    /*
     * And nothing in motion. A transition or a keyframe has no idea a
     * page is being printed: it carries on from wherever it had got
     * to, so an element can print half faded in, or with the color it
     * was passing through on its way somewhere else. Found by
     * measuring a button mid-transition and reading back a red that
     * was on its way to transparent.
     */
    transition: none !important;
    animation: none !important;

    /*
     * Said again after the shorthand, and after it on purpose: a hero
     * photo behind text is the same problem as a dark panel, and the
     * shorthand above is not relied on to have reached it.
     */
    background-image: none !important;
}

@page {
    margin: 2cm;
}

html,
body {
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 11pt;
    line-height: 1.5;
}


/* --------------------------------------------------------------------------
   Chrome that only works when clicked
   -------------------------------------------------------------------------- */

.skip-link,
.ssc-utility-bar,
.ssc-header,
.ssc-menu-overlay,
.ssc-search-overlay,
.ssc-to-top,
.ssc-modal,
.ssb-lightbox,
.ssb-lightbox-backdrop,
.site-footer__social,
.ssb-events__filters,
.ssb-timeline__arrow {
    display: none !important;
}

/*
 * The footer keeps its copyright and loses the rest. Who published the
 * page is worth having on paper; a column of links is not.
 */
.site-footer {
    border: 0 !important;
    padding: 0 !important;
}

.site-footer__column,
.site-footer__image,
.site-footer__notice {
    display: none !important;
}

.site-footer__copyright {
    margin-top: 1.5em;
    padding-top: 0.75em;
    border-top: 1pt solid #999 !important;
    font-size: 9pt;
}


/* --------------------------------------------------------------------------
   Buttons become what they always were underneath
   -------------------------------------------------------------------------- */

/*
 * Not hidden. A button on a page is usually the one thing the page is
 * asking you to do, and its address is information. Stripped back to a
 * plain link so the rule further down can print where it goes, rather
 * than leaving a dead rectangle with a verb in it.
 */
.btn,
.ssb-buttons__btn,
.ssb-cta__buttons a,
.ssb-cta-panels__buttons a {
    display: inline !important;
    padding: 0 !important;
    border: 0 !important;
    font-weight: 700;
    text-decoration: underline !important;

    /*
     * Back to sentence case. A button's label is set in letterspaced
     * capitals, and the address printed after it inherits both -- so
     * the URL comes out shouting, with a space after every character.
     */
    text-transform: none !important;
    letter-spacing: normal !important;
}

/*
 * A button that is still on the page is a label now, not a control.
 * Without this the browser's own chrome prints around it and an
 * accordion question arrives looking like something to press.
 */
button {
    border: 0 !important;
    padding: 0 !important;
    text-align: left;
}

/*
 * And the plus or minus beside an accordion question, which is drawn
 * with a pseudo-element and only ever meant one thing: there is more
 * if you press. On paper the more is already there.
 */
.ssb-accordion__button::after {
    display: none !important;
}


/* --------------------------------------------------------------------------
   Anything folded away prints open
   -------------------------------------------------------------------------- */

/*
 * An accordion is a way of not showing you things until you ask. On
 * paper there is no asking, so a printed FAQ with every answer
 * collapsed is a page of questions -- which is worse than useless,
 * because it looks complete.
 *
 * [hidden] is a user-agent rule that any class selector outweighs, so
 * this is said with a class and a flag rather than left to chance.
 */
.ssb-accordion__panel,
.ssb-accordion__panel[hidden] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

.ssb-accordion__button {
    pointer-events: none;
}


/* --------------------------------------------------------------------------
   Where a link goes
   -------------------------------------------------------------------------- */

/*
 * Only inside content, and only for links that leave the page. Doing it
 * everywhere turns every list of links into a wall of URLs, and a
 * fragment or a mailto reads worse spelled out than it does as its own
 * text.
 */
.entry-content a[href^="http"]::after,
.page-content a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 85%;
    word-break: break-all;
}

/* An image wrapped in a link does not need the address read out. */
.entry-content a[href^="http"]:has(img)::after,
.page-content a[href^="http"]:has(img)::after {
    content: "";
}

a {
    text-decoration: underline;
}


/* --------------------------------------------------------------------------
   Where the page breaks
   -------------------------------------------------------------------------- */

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

p,
li,
blockquote {
    orphans: 3;
    widows: 3;
}

img,
figure,
table,
pre,
blockquote,
.ssb-accordion__item,
.ssb-stat-cards__card,
.ssb-people__person,
.ssb-documents__item {
    break-inside: avoid;
    page-break-inside: avoid;
}

img {
    max-width: 100% !important;
    height: auto !important;
}

table {
    width: 100% !important;
    border-collapse: collapse;
}

th,
td {
    border: 1pt solid #999 !important;
    padding: 4pt 6pt;
}

/* A table that runs over a page repeats its headings on the next one. */
thead {
    display: table-header-group;
}


/* --------------------------------------------------------------------------
   Nothing is pinned to a viewport that does not exist
   -------------------------------------------------------------------------- */

/*
 * A fixed element prints on every page in some engines and in the
 * wrong place in the rest. Sticky is the same question with a nicer
 * answer on screen and no answer at all here.
 */
.ssb-sticky-header,
.ssb-sticky-nav,
[style*="position: fixed"],
[style*="position:fixed"] {
    position: static !important;
}

/*
 * Blocks that scroll sideways on screen hand print a window onto one
 * frame of themselves. Let them run down the page instead.
 */
.ssb-image-text-carousel__track,
.ssb-timeline__track {
    display: block !important;
    overflow: visible !important;
    transform: none !important;
    width: auto !important;
}

.ssb-image-text-carousel__slide,
.ssb-timeline__item {
    width: auto !important;
    min-width: 0 !important;
    break-inside: avoid;
}

/* Video has nothing to say on paper. */
iframe,
video,
.wp-block-embed__wrapper iframe {
    display: none !important;
}
