/* CLP Region single template: intro + PDF resource grid. */

.clp-region-intro {
  margin-bottom: 56px;
}

.clp-region-title {
  color: #0b2265;
  margin-bottom: 20px;
}

.clp-region-lead {
  font-size: 18px;
  line-height: 1.5;
}

/* Grid: 3 columns on desktop, 2 on tablet, 1 on mobile. */
.clp-resource-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 991px) {
  .clp-resource-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 575px) {
  .clp-resource-grid {
    grid-template-columns: 1fr;
  }
}

.clp-resource-card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: #F6F8FA;
  border: 1px solid #e3e6ec;
  border-radius: 4px;
}

/* Preview window shows the top of page 1, scaled to width and clipped. */
.clp-resource-preview {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: #eceff1;
  border: 1px solid #e3e6ec;
}

.clp-resource-canvas {
  display: block;
  width: 100%;
  height: auto;
}

.clp-resource-preview.is-failed .clp-resource-canvas {
  display: none;
}

/* Fallback glyph, shown only when the client-side render fails. */
.clp-resource-placeholder {
  display: none;
}

.clp-resource-preview.is-failed .clp-resource-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  inset: 0;
  color: #9aa3b2;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.clp-resource-badge {
  padding: 4px 7px;
  background: #da291c;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  border-radius: 3px;
}

/* Desktop/tablet: badge overlays the bottom-right of the preview image. */
.clp-resource-badge--overlay {
  position: absolute;
  right: 12px;
  bottom: 12px;
}

/* Inline badge sits above the title in the mobile layout only. */
.clp-resource-badge--inline {
  display: none;
}

/* Neutral on desktop/tablet: children flow as if direct card children so the
   existing vertical stack is unchanged. Becomes a flex column on mobile. */
.clp-resource-copy {
  display: contents;
}

/* Title pushes the button to the bottom so cards align on a row. */
.clp-resource-title {
  margin: 20px 0 auto;
  color: #0b2265;
  font-size: 18px !important;
  font-weight: 600;
  line-height: 1.3;
}

a.clp-resource-button {
  display: flex!important;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding: 14px 17px;
  border: 1px solid #7F8A9D;
  color: #0b2265!important;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none!important;
  transition: background-color 0.15s ease, color 0.15s ease;
}

a.clp-resource-button span {
  color: #0b2265;
  flex: 1;
}

/* Theme's global `a:hover`/`a span:hover` forces navy with !important, so the
   label and arrow need !important here to stay legible on the navy fill. */
.clp-resource-button:hover,
.clp-resource-button:focus,
.clp-resource-button:hover span,
.clp-resource-button:focus span {
  color: #fff !important;
}

.clp-resource-button:hover,
.clp-resource-button:focus {
  background: #0b2265;
}

.clp-resource-arrow {
  flex: none;
}

/* Mobile: horizontal card — portrait cover left, badge + title right, button
   below. Placed after the base rules so it wins the cascade at this width. */
@media (max-width: 575px) {
  .clp-resource-card {
    display: grid;
    grid-template-columns: 78px 1fr;
    grid-template-areas:
      "preview copy"
      "button  button";
    column-gap: 18px;
    row-gap: 18px;
    align-items: start;
  }

  /* Show the full page-1 cover instead of the clipped landscape crop. Top-align
     with the badge (matching its 10px offset) so the image top always lines up. */
  .clp-resource-preview {
    grid-area: preview;
    align-self: start;
    aspect-ratio: auto;
  }

  .clp-resource-copy {
    grid-area: copy;
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-self: start;
  }

  .clp-resource-badge--overlay {
    display: none;
  }

  .clp-resource-badge--inline {
    display: inline-block;
    align-self: start;
    padding: 6px 8px;
    font-size: 14px;
    line-height: 1;
    border-radius: 0;
    margin-top: 10px;
  }

  .clp-resource-title {
    margin: 0;
    font-size: 20px!important;
    font-weight: 400;
    line-height: 24px;
    color: #000b23;
  }

  a.clp-resource-button {
    margin-top: 2px;
  }

  .clp-resource-button {
    grid-area: button;
    margin-top: 0;
  }
}
