/**
 * MLT Helpsheets: helpsheet tiles, service filters and the helpsheet page.
 * Colours come from the brand colours set in Customer Setup (TeamPlus
 * --mt-color-* variables), with sensible fallbacks.
 */
.mlt-helpsheets,
.mlth-item {
  --mlth-primary: var(--mt-color-primary, #0f6ff0);
  --mlth-primary-dark: var(--mt-color-primary-dark, #0b5ccc);
  --mlth-on-primary: var(--mt-color-primary-contrast, #ffffff);
  --mlth-dark: var(--mt-color-dark-colored, #0f2a3c);
  --mlth-text: var(--mt-color-default-contrast, #2d3748);
  --mlth-soft: var(--mt-color-default-light, #f5f7fa);
  --mlth-line: rgba(0, 0, 0, 0.08);
  --mlth-radius: var(--mt-radius, 12px);
}

/* ---- Service filters ---------------------------------------------------- */
.mlth-filters ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
}

.mlth-filters a {
  display: inline-block;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--mlth-line);
  border-radius: 999px;
  background: var(--mt-surface, #fff);
  color: var(--mlth-text);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.mlth-filters a:hover,
.mlth-filters a.is-active {
  background: var(--mlth-primary);
  border-color: var(--mlth-primary);
  color: var(--mlth-on-primary);
}

/* ---- Grid ------------------------------------------------------------------ */
.mlt-helpsheets .view-content,
.mlth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.mlt-helpsheets .views-row {
  display: flex;
}

.mlth-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
  background: var(--mt-surface, #fff);
  border: 1px solid var(--mlth-line);
  border-radius: var(--mlth-radius);
  color: var(--mlth-text) !important;
  text-decoration: none !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.mlth-card:hover {
  transform: translateY(-3px);
  border-color: var(--mlth-primary);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.1);
}

.mlth-card:focus-visible {
  outline: 3px solid var(--mlth-primary);
  outline-offset: 3px;
}

.mlth-card__media {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--mlth-soft);
  border-bottom: 1px solid var(--mlth-line);
}

.mlth-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform 0.4s ease;
}

.mlth-card:hover .mlth-card__media img {
  transform: scale(1.04);
}

.mlth-card__title {
  padding: 1rem 1.2rem 1.15rem;
  font-family: var(--mt-hff, inherit);
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.35;
}

.mlt-helpsheets .pager {
  margin-top: 2.5rem;
}

/* ---- Item page ------------------------------------------------------------- */
.mlth-item {
  color: var(--mlth-text);
}

.mlth-item__text {
  max-width: 760px;
  margin-bottom: 2rem;
  font-size: 1.08rem;
  line-height: 1.75;
}

.mlth-item h2 {
  font-family: var(--mt-hff, inherit);
}

.mlth-tags {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--mlth-line);
}

.mlth-tags h2 {
  margin: 0 0 0.9rem;
  font-size: 1.1rem;
}

.mlth-tags ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mlth-tags a {
  display: inline-block;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--mlth-line);
  border-radius: 999px;
  color: var(--mlth-text);
  text-decoration: none;
}

.mlth-tags a:hover {
  background: var(--mlth-primary);
  border-color: var(--mlth-primary);
  color: var(--mlth-on-primary);
}

.mlth-cta {
  margin: 2.5rem 0;
  padding: 2rem;
  background: var(--mlth-dark);
  border-radius: var(--mlth-radius);
  color: #fff;
  text-align: center;
}

.mlth-cta h2 {
  margin: 0 0 0.5rem;
  color: #fff;
}

.mlth-cta p {
  margin: 0 0 1.25rem;
  opacity: 0.9;
}

.mlth-cta__buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.mlth-btn {
  display: inline-block;
  padding: 0.8rem 1.4rem;
  border: 2px solid transparent;
  border-radius: var(--mt-radius-sm, 8px);
  font-weight: 700;
  text-decoration: none !important;
}

.mlth-btn--primary {
  background: var(--mlth-primary);
  color: var(--mlth-on-primary) !important;
}

.mlth-btn--primary:hover {
  background: var(--mlth-primary-dark);
}

.mlth-btn--outline {
  border-color: #fff;
  color: #fff !important;
}

.mlth-btn--outline:hover {
  background: rgba(255, 255, 255, 0.12);
}

.mlth-more {
  margin-top: 3rem;
}

.mlth-more h2 {
  margin: 0 0 1.25rem;
}

/* ---- PDF badge and empty tile -------------------------------------------------- */
.mlth-card__media {
  position: relative;
}

.mlth-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: var(--mlth-primary);
  color: var(--mlth-on-primary);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.mlth-card__media--empty {
  background:
    linear-gradient(135deg, var(--mlth-dark), hsla(var(--mt-color-dark-colored-value, 205, 60%, 15%), 0.85));
}

.mlth-card__media--empty .mlth-badge {
  top: 50%;
  left: 50%;
  right: auto;
  padding: 0.6rem 1.1rem;
  font-size: 1.2rem;
  transform: translate(-50%, -50%);
}

/* ---- Helpsheet page ---------------------------------------------------------- */
.mlth-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1.5rem;
}

.mlth-size {
  font-size: 0.9rem;
  opacity: 0.75;
}

.mlth-viewer {
  height: 85vh;
  min-height: 600px;
  overflow: hidden;
  background: var(--mlth-soft);
  border: 1px solid var(--mlth-line);
  border-radius: var(--mlth-radius);
}

.mlth-viewer iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.mlth-mobile {
  display: none;
}

@media (max-width: 767px) {
  .mlth-viewer {
    display: none;
  }

  .mlth-mobile {
    display: block;
    text-align: center;
    text-decoration: none !important;
  }

  .mlth-mobile img {
    display: block;
    width: 100%;
    height: auto;
    margin-bottom: 1rem;
    border: 1px solid var(--mlth-line);
    border-radius: var(--mlth-radius);
  }

  .mlth-mobile .mlth-btn {
    width: 100%;
  }
}

@media (max-width: 575px) {
  .mlth-cta {
    padding: 1.5rem;
  }

  .mlth-btn {
    width: 100%;
  }
}
