/* Intention: provide a concise, well-designed print version of webpages */
/* https://www.smashingmagazine.com/2013/03/tips-and-tricks-for-print-style-sheets/ */
/* https://www.smashingmagazine.com/2015/01/designing-for-print-with-css/ */
/* https://www.smashingmagazine.com/2018/05/print-stylesheets-in-2018/ */
@media print {
  @page {
    margin: 2.5cm;
  }

  /* Debugging Only */
  /* div {
    border: 1px solid black;
  } */

  body,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p,
  a,
  td,
  th,
  div,
  legend {
    background: #fff !important; /* Explicit bg color should always be white */
    color: #000 !important; /* Explicit text color should always be black */
  }

  body,
  article {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .grid-container {
    padding: 0;
  }

  .print-logo {
    display: block;
    margin-left: 0.25rem;
  }

  h1 {
    margin: 0;
    padding: 0;
    background: none;
  }

  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid; /* avoid breaks directly after a heading */
    color: #000;
    widows: 2;
    orphans: 3;

    a::after {
      font-size: 9pt;
    }
  }

  .content-subheading,
  .ds-region-highlight,
  .ds-region-content {
    margin: 0;
    padding: 0;
  }

  /* Hide unnecessary elements */
  #block-fdic-theme-governmentbanner,
  header,
  .usa-header,
  nav,
  aside,
  footer,
  embed,
  object,
  video,
  audio,
  iframe,
  .media--type-remote-video,
  #block-fdic-theme-sharethis,
  #QSISlider,
  .QSISlider,
  .QSISlider *,
  #block-fdic-theme-news-node-inactive-block,
  #block-fdic-theme-breadcrumbs,
  .extlink,
  .usa-alert--error,
  .views-exposed-form,
  .usa-pagination,
  .ds-region-left,
  #block-fdic-theme-primary-local-tasks,
  ed11y-element-panel,
  .contextual,
  .fdic-share,
  .video-icon,
  .views-view-navigation,
  .more-link,
  .more-link a,
  .glider-track {
    display: none;
  }

  .bg-meet-our-team {
    max-height: auto;
    margin-right: 0;
    margin-left: 0;
  }

  .ds-region-highlight {
    display: inline-block;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: #000;
    letter-spacing: normal;
    text-align: center;
  }

  /* Speeches Only */
  .news-type--speeches {
    .news-heading-wrapper {
      margin: 50% auto 0;
      max-width: 60%;
      text-align: center;
    }

    .ds-region-content,
    article.node--news,
    .field--name-body {
      page-break-before: always;
    }

    .content-subtitle {
      margin-bottom: 2rem;
      font-family: "Times New Roman";
    }

    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    p,
    .news-byline,
    ul,
    ol,
    .block-fdic-node-last-updated-block p {
      font-family: "Times New Roman";
    }

    table.footnotes tr > td {
      padding: 0;
      font-family: "Times New Roman";
    }

    .usa-icon {
      display: none;
    }
  }

  /* Override news.css' .node--news.node--full block */
  .news-type--speeches.node--news.node--full {
    p, ul, ol, li, tbody tr td, blockquote {
      font-family: "Times New Roman";
      font-size: 12pt;
    }
  }

  /* Article Node Types - Consumer Resource Center */
  /* Consumer News, Money Smart */
  .node--type-article {
    .ds-region-abovecontent {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
    }

    .ds-region-highlight {
      display: none;
    }

    #block-fdic-theme-nodesubtitle {
      flex: 1;
      order: 1;
      margin: 0 0 1rem;
      color: var(--fdic-dark-blue) !important;
      font-family: var(--font-family-sans-pro);
      font-size: 1.75rem;
      font-weight: 700;
      text-align: left;
    }

    #block-fdic-theme-node-title-block {
      order: 3;
      flex-basis: 100%;

      h1 {
        color: var(--fdic-dark-blue) !important;
        font-size: 1.75rem;
        font-weight: 400;
        text-align: left;
      }
    }

    #block-fdic-theme-node-subheading-block {
      order: 2;

      .content-subheading {
        margin: 0 0 1.5rem;
        color: var(--fdic-dark-blue) !important;
        font-family: var(--font-family-sans-pro);
        font-style: normal;
        font-weight: bold;
        text-align: right;
      }
    }

    .node--article {
      h2,
      h3,
      h4,
      h5,
      h6 {
        margin-bottom: 0;
        color: var(--fdic-dark-blue) !important;

        strong {
          font-weight: 400;
        }

        + p {
          margin-top: 0;
        }
      }

      .paragraph--type--text {
        p,
        ul li {
          font-size: 0.75rem;
          line-height: 1.5;
        }
      }

      .paragraph--type--from-library {
        display: none;
      }
    }
  }

  .content-subtitle {
    color: #000;
    font-size: 12pt;
  }

  p {
    font-size: 12pt;
    widows: 2;
    orphans: 3;
  }

  table:not(.footnotes),
  figure {
    page-break-inside: avoid; /* avoid breaking tables and figures */
  }

  .paragraph--type--card {
    break-inside: avoid;
  }

  .paragraph--type--main-body-section {
    min-height: 0;

    .field--name-field-mbs-content {
      padding: 0;
    }
  }

  .bg-blue {
    padding-bottom: 0;
  }

  /* Fixes to render issues stemming from printing full URLs from links within a td */
  table:not(.footnotes) {
    th,
    td {
      font-size: 10pt;

      a {
        text-decoration: none;
      }

      a.footnote__citation {
        margin-left: 1pt;
      }
    }

    tr a::after {
      /* display: block; */
      font-size: 8pt;
      word-break: break-all;
    }
  }

  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }

  a {
    color: #000 !important;
    text-decoration: underline;

    &.font-header-arrow,
    &.font-header-arrow::after {
      font-size: 12pt !important;
      font-weight: normal !important;
      letter-spacing: normal !important;
      text-decoration: underline !important;
    }
  }

  /* NOT printing href paths from: queries, fn numbers */
  a:not([href*='?combine']):not(.footnote__reference, .footnote__anchor, .footnote__citation, .footnotes__item-backlink)::after {
    content: ' (' attr(href) ') '; /* Default space before/after */
    overflow-wrap: anywhere;
  }

  a.remove-trailing-space:not([href*='?combine']):not(.footnote__reference, .footnote__anchor, .footnote__citation, .footnotes__item-backlink)::after {
    content: ' (' attr(href) ')'; /* Remove space after */
  }

  /* Print absolute URL before hash anchors, exclude fn numbers */
  a[href*='#']:not(.footnote__reference, .footnote__anchor, .footnote__citation, .footnotes__item-backlink)::after {
    content: ' (' attr(data-full-url) ') '; /* Default space before/after */
    overflow-wrap: anywhere;
  }

  a[href*='#'].remove-trailing-space:not(.footnote__reference, .footnote__anchor, .footnote__citation, .footnotes__item-backlink)::after {
    content: ' (' attr(data-full-url) ')'; /* Remove space after */
    overflow-wrap: anywhere;
  }

  /* Hides empty links or empty in-page anchor links */
  a[href=''],
  a[href='#'],
  a:not([href]) {
    display: none;
  }

  /* Adds domain ahead of relative links */
  a[href^='/']::after {
    content: ' (https://www.fdic.gov' attr(href) ') ' !important; /* Default space before/after */
    overflow-wrap: anywhere;
  }

  a[href^='/'].remove-trailing-space::after {
    content: ' (https://www.fdic.gov' attr(href) ')' !important; /* Remove space after */
  }

  .hide-url {
    text-decoration: none;

    &::after {
      content: '' !important;
    }
  }

  #block-fdic-theme-news-last-updated-block p {
    margin-bottom: 0;
    font-size: 9pt;
  }

  /* Footnotes */
  /* Bluebook standards for pub titles in speech footnotes */
  /* Text of title must be italics when viewed online /*
  /* Small caps in print. */
  ul.footnotes,
  table.footnotes {
    margin: 0 0 1rem;
    font-size: 9pt;

    /* Targets .pub-title and .pub-author style added by editor */
    .pub-title,
    .pub-author {
      font-variant: small-caps;
      font-style: normal;
    }
  }

  /* Table footnotes only */
  table.footnotes {
    /* Stubborn table footnote styles */
    tr td {
      padding: 0 !important;
      font-size: 9pt;
      text-align: left !important;

      &:nth-child(1) {
        width: auto !important;
        padding-right: 0.25rem !important;
      }
    }
  }

  /* Non-table footnotes only */
  ul.footnotes {
    /* Footnote area */
    .footnote__anchor,
    .footnotes__item-backlink {
      top: 0;
      width: auto;
      margin-top: -0.25rem;
      margin-right: 0.25rem;
    }
  }

  .footnote__reference,
  .footnote__citation,
  .footnote__anchor,
  .footnotes__item-backlink {
    margin: 0;
    padding: 0;
    font-size: 75%;
    font-weight: normal;
    line-height: none;
    text-decoration: none;
  }

  /* Footnote in text */
  .footnote__reference,
  .footnote__citation {
    margin-top: 0;
    vertical-align: super;
  }

  .footnote__citation {
    margin-left: -4pt;
  }

  /* Footnote area */
  .footnote__anchor,
  .footnotes__item-backlink {
    position: relative;
    top: -0.25rem;
    width: auto;
  }

  .footnotes__item-text {
    p {
      margin: 0;
    }
  }

  @page {
    @footnote {
      padding-top: 0.5em;
      border-top: 1pt solid black;
    }
  }
}
