/**
 * MLT Blog: blog cards, the latest posts list and the blog post page.
 * Colours come from the brand colours set in Customer Setup (TeamPlus
 * --mt-color-* variables), with sensible fallbacks.
 */
.mlt-blog,
.mltb-post {
  --mltb-primary: var(--mt-color-primary, #0f6ff0);
  --mltb-primary-dark: var(--mt-color-primary-dark, #0b5ccc);
  --mltb-on-primary: var(--mt-color-primary-contrast, #ffffff);
  --mltb-dark: var(--mt-color-dark-colored, #0f2a3c);
  --mltb-text: var(--mt-color-default-contrast, #2d3748);
  --mltb-soft: var(--mt-color-default-light, #f5f7fa);
  --mltb-line: rgba(0, 0, 0, 0.08);
  --mltb-radius: var(--mt-radius, 12px);
}

/* ---- Card grid (/blogs page and grid block) ---------------------------- */
.mlt-blog .view-content,
.mltb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.75rem;
}

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

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

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

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

.mltb-card__media {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--mltb-soft);
}

.mltb-card__media img,
.mltb-card__media > div,
.mltb-card__media .field-content {
  display: block;
  width: 100%;
  height: 100%;
}

.mltb-card__media img {
  object-fit: cover;
}

.mltb-card__inner {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1.25rem 1.35rem 1.4rem;
}

.mltb-card__date {
  color: var(--mltb-primary);
  font-size: 0.85rem;
  font-weight: 700;
}

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

.mltb-card__text {
  font-size: 0.95rem;
  line-height: 1.6;
  opacity: 0.85;
}

.mltb-card__more {
  margin-top: auto;
  padding-top: 0.5rem;
  color: var(--mltb-primary);
  font-weight: 700;
}

/* ---- Latest posts list (sidebar block) --------------------------------- */
.mlt-blog--list .view-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mlt-blog--list .mltb-card {
  flex-direction: row;
  align-items: center;
}

.mlt-blog--list .mltb-card:hover {
  transform: none;
}

.mlt-blog--list .mltb-card__media {
  flex: 0 0 88px;
  aspect-ratio: 1;
}

.mlt-blog--list .mltb-card__inner {
  gap: 0.2rem;
  padding: 0.75rem 1rem;
}

.mlt-blog--list .mltb-card__title {
  font-size: 0.98rem;
}

.mlt-blog--list .mltb-card__text,
.mlt-blog--list .mltb-card__more {
  display: none;
}

/* ---- Pager on /blogs ---------------------------------------------------- */
.mlt-blog .pager {
  margin-top: 2.5rem;
}

/* ---- Blog post page ------------------------------------------------------ */
.mltb-post {
  max-width: 820px;
  margin: 0 auto;
  color: var(--mltb-text);
}

.mltb-post__date {
  margin: 0 0 0.5rem;
  color: var(--mltb-primary);
  font-weight: 700;
}

.mltb-post__sub {
  margin-bottom: 1.75rem;
  font-size: 1.2rem;
  line-height: 1.6;
}

.mltb-post__image img {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 2rem;
  border-radius: var(--mltb-radius);
}

.mltb-post__body {
  font-size: 1.05rem;
  line-height: 1.75;
}

.mltb-post__body h2,
.mltb-post__body h3 {
  margin-top: 2rem;
}

.mltb-post__body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--mt-radius-sm, 8px);
}

.mltb-post__body a {
  color: var(--mltb-primary);
  text-underline-offset: 3px;
}

.mltb-post__gallery {
  margin-top: 2rem;
}

.mltb-post__gallery .field__items,
.mltb-post__gallery > div {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.mltb-post__gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--mt-radius-sm, 8px);
}

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

/* Tags */
.mltb-post__tags {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--mltb-line);
}

.mltb-post__tags h2 {
  margin: 0 0 0.9rem;
  font-size: 1.1rem;
}

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

.mltb-post__tags a {
  display: inline-block;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--mltb-line);
  border-radius: 999px;
  color: var(--mltb-text);
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

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

/* Call to action */
.mltb-cta {
  margin: 2.5rem 0;
  padding: 2rem;
  background: var(--mltb-dark);
  border-radius: var(--mltb-radius);
  color: #fff;
  text-align: center;
}

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

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

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

.mltb-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;
  transition: background-color 0.2s ease, color 0.2s ease;
}

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

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

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

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

/* Previous / next */
.mltb-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 2.5rem 0;
}

.mltb-pager a {
  display: block;
  padding: 1rem 1.25rem;
  border: 1px solid var(--mltb-line);
  border-radius: var(--mltb-radius);
  color: var(--mltb-text);
  font-weight: 700;
  text-decoration: none;
}

.mltb-pager a:hover {
  border-color: var(--mltb-primary);
}

.mltb-pager span {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--mltb-primary);
  font-size: 0.85rem;
}

.mltb-pager__next {
  grid-column: 2;
  text-align: right;
}

/* Related posts */
.mltb-related {
  margin-top: 3rem;
}

.mltb-related h2 {
  margin: 0 0 1.25rem;
}

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

  .mltb-pager__next {
    grid-column: 1;
    text-align: left;
  }

  .mltb-cta {
    padding: 1.5rem;
  }

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

@media (prefers-reduced-motion: reduce) {
  .mltb-card,
  .mltb-card:hover {
    transition: none;
    transform: none;
  }
}
