.resource {
    width: 20%;
    display: block;
    max-width: 200px;
    min-width: 165px;
    background-color: var(--twp-darkest-purple);
    text-decoration: none;
    transition-duration: 0.33333s;
    transition-property: all;
    transition-timing-function: ease-in-out;
}

.resource.with-bg {
    text-shadow: 0px 0px 10px var(--twp-black), 1px 1px 0px var(--twp-black);
}

.resource div {
    padding: 0.5rem;
    min-height: 200px;
    aspect-ratio: 5/7;
    position: relative;
    padding-bottom: 2rem;
    box-shadow: var(--twp-box-shadow);
    background-size: cover;
    background-position: center;
    mix-blend-mode: luminosity;
}

.resource div img {
    width: 50%;
    margin-top: 1rem;
    margin-left: auto;
    margin-right: auto;
    display: block;
    margin-bottom: 0.75rem;
}

.resource .title {
    color: var(--twp-white);
    text-align: center;
    text-transform: uppercase;
    font-size: 0.9rem;
    margin-left: auto;
    margin-right: auto;
    display: block;
}

.resource .footer {
    color: var(--twp-white);
    font-size: 0.5rem;
    text-transform: uppercase;
    font-weight: 200;
    margin-left: auto;
    margin-right: auto;
    display: block;
    width: 100%;
    text-align: center;
    position: absolute;
    bottom: 0.75rem;
    left: 0px;
    right: 0px;
}

#class-resources-wrapper {
    overflow-x: visible;
    overflow-y: auto;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 1.5rem;
    margin-left: -1.5rem;
}

.back-link {
    color: var(--twp-black) !important;
    font-size: 0.8rem;
    margin-top: -1rem;
    display: block;
    margin-bottom: -1rem;
    text-decoration: none;
    border-bottom: 1px solid var(--twp-black);
    width: fit-content;
    transition-duration: 0.33333s;
    transition-property: all;
    transition-timing-function: ease-in-out;
}

@media (hover: hover) {
  .resource:hover {
    box-shadow: var(--twp-box-shadow-black);
  }

  .back-link:hover {
    border-bottom: 1px solid var(--twp-orange);
  }
}

/* Single class-resource PDF viewer — fit Letter (8.5x11) pages to the visible column */
.single-class_resource #page-content-wrapper {
  max-width: 100%;
  overflow-x: hidden;
}

.single-class_resource #inner-content-wrapper,
.single-class_resource #primary,
.single-class_resource .the-post,
.single-class_resource .twp-pdf-viewer,
.single-class_resource .twp-pdf-pages {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.the-post {
  max-width: 100%;
}

.twp-pdf-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
}

.twp-pdf-btn {
  display: inline-block;
  appearance: none;
  border: 1px solid var(--twp-darkest-purple);
  background: var(--twp-white);
  color: var(--twp-darkest-purple);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.2;
  padding: 0.65rem 1rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.twp-pdf-btn-primary,
.print-vendors.twp-pdf-btn {
  background: var(--twp-darkest-purple);
  color: var(--twp-white);
  margin: 0;
}

.twp-pdf-viewer {
  width: 100%;
  max-width: 100%;
}

.twp-pdf-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: #4a4a4a;
  padding: 0.75rem;
  box-sizing: border-box;
  touch-action: pan-y;
}

.twp-pdf-page {
  width: 100%;
  max-width: 100%;
  background: var(--twp-white);
  box-shadow: var(--twp-box-shadow-small);
  overflow: hidden;
}

.twp-pdf-page canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.twp-pdf-fallback {
  background: var(--twp-white);
  padding: 1.25rem;
  color: var(--twp-black);
}

.twp-pdf-print-frame {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 0;
  height: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

@media screen and (max-width: 1024px) {
  .single-class_resource #inner-content-wrapper {
    width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media screen and (max-width: 782px) {
  .twp-pdf-toolbar {
    justify-content: stretch;
  }

  .twp-pdf-btn {
    flex: 1 1 100%;
  }

  .twp-pdf-pages {
    padding: 0.4rem;
    gap: 0.4rem;
  }
}

@media print {
  #masthead,
  #colophon,
  #navigation-sidebar,
  #open-sidebar,
  .back-link,
  .twp-pdf-toolbar,
  .twp-pdf-print-frame {
    display: none !important;
  }

  #page-content-wrapper,
  #inner-content-wrapper,
  #primary,
  .the-post {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    background: white !important;
  }

  .twp-pdf-pages {
    background: none;
    padding: 0;
    gap: 0;
  }

  .twp-pdf-page {
    box-shadow: none;
    overflow: visible !important;
    display: block !important;
    break-after: page;
    page-break-after: always;
  }

  .twp-pdf-page canvas {
    width: 100% !important;
    height: auto !important;
  }

  .twp-pdf-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }
}