/**
 * Resource Library block styles.
 *
 * Standalone stylesheet (enqueued by the block) so no rebuild of the Vite
 * bundle is required. Uses the theme's CSS variables (emitted by Tailwind v4
 * from globals.css) with hex fallbacks.
 */

.resource-library {
  --rl-navy: var(--color-brand-navy, #17315a);
  --rl-blue: var(--color-brand-blue, #26597c);
  --rl-blue-light: var(--color-brand-blue-light, #9fc7da);
  --rl-teal: var(--color-brand-teal, #2d6e8d);
  --rl-teal-light: var(--color-brand-teal-light, #f1f7f9);
  --rl-orange: var(--color-brand-orange, #e47225);
  --rl-yellow: var(--color-brand-yellow, #f9a71c);
  --rl-grey: var(--color-brand-grey, #e2e5eb);
  --rl-cream: #fffaf1;
  --rl-cream-border: #f3dcb4;

  color: var(--rl-navy);
}

.resource-library .rl-container {
  max-width: 80rem;
  margin-inline: auto;
  padding-inline: 1rem;
}

.resource-library .rl-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.resource-library .rl-intro {
  margin: 0 0 1.5rem;
  font-size: 1.0625rem;
}

/* ------------------------------------------------------------- tabs */

.resource-library .rl-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: -1px;
  position: relative;
  z-index: 1;
}

.resource-library .rl-tab {
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--rl-blue);
  background: var(--rl-teal-light);
  border: 1px solid var(--rl-blue-light);
  border-bottom: none;
  border-radius: 0.375rem 0.375rem 0 0;
  padding: 0.75rem 1.5rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.resource-library .rl-tab:hover {
  background: #fff;
}

.resource-library .rl-tab-active {
  background: #fff;
  color: var(--rl-navy);
  border-color: var(--rl-navy);
  position: relative;
}

/* Mask the panel's top border under the active tab */
.resource-library .rl-tab-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: #fff;
}

/* ------------------------------------------------------------ panel */

.resource-library .rl-panel {
  border-top: 1px solid var(--rl-navy);
  padding-top: 1.5rem;
}

.resource-library .rl-panel[aria-busy="true"] .rl-results,
.resource-library .rl-loading .rl-results {
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

/* ----------------------------------------------------------- search */

.resource-library .rl-search {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.resource-library .rl-search-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--rl-blue-light);
  border-radius: 0.375rem;
  padding: 0.625rem 1rem;
  font: inherit;
  color: var(--rl-navy);
  background: #fff;
}

.resource-library .rl-search-input::placeholder {
  color: #6b7a90;
}

.resource-library .rl-search-input:focus-visible {
  outline: 2px solid var(--rl-teal);
  outline-offset: 1px;
}

.resource-library .rl-search-btn {
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: var(--rl-navy);
  border: 1px solid var(--rl-navy);
  border-radius: 0.375rem;
  padding: 0.625rem 1.5rem;
  transition: background-color 0.15s ease;
}

.resource-library .rl-search-btn:hover {
  background: var(--rl-teal);
  border-color: var(--rl-teal);
}

/* ---------------------------------------------------------- filters */

.resource-library .rl-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-bottom: 1rem;
}

.resource-library .rl-filter {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  min-width: 13rem;
}

.resource-library .rl-filter-label {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--rl-navy);
}

.resource-library .rl-filter-toggle {
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--rl-navy);
  background: #fff;
  border: 1px solid var(--rl-blue-light);
  border-radius: 0.375rem;
  padding: 0.5rem 0.875rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  text-align: left;
}

.resource-library .rl-filter-toggle:focus-visible {
  outline: 2px solid var(--rl-teal);
  outline-offset: 1px;
}

.resource-library .rl-filter-chevron {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.resource-library .rl-filter-toggle[aria-expanded="true"] .rl-filter-chevron {
  transform: rotate(180deg);
}

.resource-library .rl-filter-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 30;
  margin-top: 0.25rem;
  background: #fff;
  border: 1px solid var(--rl-blue-light);
  border-radius: 0.375rem;
  box-shadow: 0 8px 20px rgba(23, 49, 90, 0.12);
  max-height: 18rem;
  overflow-y: auto;
}

.resource-library .rl-filter-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
}

.resource-library .rl-filter-option-all-item {
  border-bottom: 1px solid rgba(23, 49, 90, 0.12);
  margin-bottom: 0.25rem;
  padding-bottom: 0.25rem;
}

.resource-library .rl-filter-option-all {
  font-weight: 600;
}

.resource-library .rl-filter-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.9375rem;
  cursor: pointer;
}

.resource-library .rl-filter-option:hover {
  background: var(--rl-teal-light);
}

.resource-library .rl-filter-option input {
  accent-color: var(--rl-navy);
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

/* ------------------------------------------------------------ chips */

.resource-library .rl-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1rem;
}

.resource-library .rl-chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.resource-library .rl-chip {
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--rl-navy);
  background: #fdf3dc;
  border: 1px solid var(--rl-yellow);
  border-radius: 9999px;
  padding: 0.25rem 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.resource-library .rl-chip:hover {
  background: #fbe7bb;
}

.resource-library .rl-chip-x {
  font-size: 1rem;
  line-height: 1;
}

.resource-library .rl-clear {
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--rl-blue);
  background: none;
  border: none;
  padding: 0;
  text-decoration: underline;
}

.resource-library .rl-clear:hover {
  color: var(--rl-navy);
}

/* ------------------------------------------------------------ count */

.resource-library .rl-count {
  font-size: 0.875rem;
  margin: 0 0 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rl-cream-border);
}

/* ------------------------------------------------------------ cards */

.resource-library .rl-results {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.resource-library .rl-empty {
  margin: 2rem 0;
  font-size: 1.0625rem;
}

.resource-library .rl-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.375rem;
  padding: 2rem 1.75rem;
}

/* Alternate rows: odd rows tinted, even rows plain */
.resource-library .rl-card:nth-child(odd) {
  background: var(--rl-cream);
  border-color: var(--rl-cream-border);
}

.resource-library .rl-card-thumb {
  flex-shrink: 0;
  width: 5rem;
}

.resource-library .rl-card-thumb img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rl-grey);
}

.resource-library .rl-card-body {
  flex: 1;
  min-width: 0;
}

.resource-library .rl-card-title {
  margin: 0 0 0.375rem;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
}

.resource-library .rl-card-title a {
  color: var(--rl-navy);
  text-decoration: none;
}

.resource-library .rl-card-title a:hover {
  color: var(--rl-teal);
  text-decoration: underline;
}

.resource-library .rl-card-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin: 0 0 0.375rem;
  padding: 0;
}

.resource-library .rl-card-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--rl-blue);
  background: var(--rl-grey);
  border-radius: 0.25rem;
  padding: 0.125rem 0.5rem;
}

.resource-library .rl-card-desc {
  margin: 0.25rem 0 0;
  font-size: 0.9375rem;
  color: #3d4f6b;
}

.resource-library .rl-card-actions {
  display: flex;
  flex-shrink: 0;
  gap: 0.75rem;
  align-items: center;
}

.resource-library .rl-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: 9999px;
  padding: 0.5rem 1.25rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.resource-library .rl-btn-icon {
  width: 1rem;
  height: 1rem;
}

.resource-library .rl-btn-preview {
  color: #fff;
  background: var(--rl-navy);
}

.resource-library .rl-btn-preview:hover {
  background: var(--rl-teal);
  color: #fff;
}

.resource-library .rl-btn-download {
  color: var(--rl-navy);
  background: var(--rl-yellow);
}

.resource-library .rl-btn-download:hover {
  background: var(--rl-orange);
  color: #fff;
}

/* ------------------------------------------------------- pagination */

.resource-library .rl-pagination {
  margin-top: 2rem;
}

.resource-library .rl-pagination-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.375rem;
  margin: 0;
  padding: 0;
}

.resource-library .rl-page {
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--rl-navy);
  background: #fff;
  border: 1px solid var(--rl-blue-light);
  border-radius: 0.25rem;
  min-width: 2.25rem;
  padding: 0.375rem 0.625rem;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.resource-library button.rl-page:hover {
  background: var(--rl-teal-light);
}

.resource-library .rl-page-current {
  background: var(--rl-navy);
  border-color: var(--rl-navy);
  color: #fff;
  cursor: default;
}

.resource-library .rl-page-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  padding: 0.375rem 0;
  color: var(--rl-blue);
}

/* --------------------------------------------------- map promo section */

.resource-library .rl-map-promo {
  margin-top: 3.5rem;
}

.resource-library .rl-map-promo-heading {
  margin: 0 0 1.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--rl-navy);
}

.resource-library .rl-map-promo-inner {
  display: flex;
  align-items: flex-start;
  gap: 2.5rem;
}

.resource-library .rl-map-promo-content {
  flex: 1;
  padding-top: 1.5rem;
}

.resource-library .rl-map-promo-text {
  margin: 0 0 1.75rem;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--rl-navy);
  max-width: 26rem;
}

.resource-library .rl-map-promo-btn {
  font-size: 0.9375rem;
  padding: 0.625rem 1.5rem;
}

.resource-library .rl-map-promo-map {
  display: block;
  flex: 0 0 55%;
  min-height: 22rem;
  border-radius: 0.375rem;
  /* Grey gradient placeholder for the map, fading out to the left */
  background: linear-gradient(
    to left,
    #b9bfc9 0%,
    #d4d9e0 45%,
    #e9ecf0 75%,
    rgba(233, 236, 240, 0) 100%
  );
}

.resource-library .rl-map-promo-map:focus-visible {
  outline: 2px solid var(--rl-teal);
  outline-offset: 2px;
}

.resource-library .rl-map-promo-map-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  min-height: inherit;
}

/* Standalone Map Promo block: spacing is handled by the block's own
   margin settings, not the in-tab offset. */
.map-promo-block .rl-map-promo {
  margin-top: 0;
}

/* When an image is uploaded, let it fill the area and fade out to the
   left like the design (replaces the gradient placeholder). */
.resource-library .rl-map-promo-map-has-image {
  background: none;
  overflow: hidden;
}

.resource-library .rl-map-promo-map-img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: inherit;
  object-fit: cover;
  -webkit-mask-image: linear-gradient(to left, #000 50%, transparent 100%);
   mask-image: linear-gradient(to left, #000 50%, transparent 100%);
}

/* -------------------------------------------------------- responsive */

@media (max-width: 767px) {
  .resource-library .rl-filters {
    flex-direction: column;
    gap: 0.75rem;
  }

  .resource-library .rl-filter {
    min-width: 0;
  }

  .resource-library .rl-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .resource-library .rl-card-thumb {
    order: -1;
  }

  .resource-library .rl-card-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .resource-library .rl-tab {
    flex: 1 1 auto;
    text-align: center;
    padding: 0.625rem 0.875rem;
  }

  .resource-library .rl-map-promo-inner {
    flex-direction: column;
    gap: 1.5rem;
  }

  .resource-library .rl-map-promo-content {
    padding-top: 0;
  }

  .resource-library .rl-map-promo-map {
    width: 100%;
    flex: none;
    min-height: 14rem;
  }
}
