/* Sponsored placement cards. Do not set .direct-grid column counts; the shared
   home-directory rules already choose 7 / 4 / 5 / 4 tracks by viewport. */

.direct-grid > .ml-ad-top {
  grid-column: span 2;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-content: center;
  justify-items: stretch;
  gap: 2px 8px;
  min-width: 0;
  padding: 8px;
  text-align: start;
}

.ml-ad-logo {
  box-sizing: border-box;
  object-fit: contain;
  background: #fff;
}

.direct-grid > .ml-ad-top .ml-ad-logo {
  grid-row: span 2;
  width: 72px;
  height: 44px;
  justify-self: center;
}

.ml-ad-badge {
  justify-self: start;
  width: max-content;
  max-width: 100%;
  padding: 0 5px;
  border: 1px solid #f0c6d5;
  border-radius: 4px;
  color: var(--accent-dark, #9c1f4b);
  background: var(--surface-muted, #fff5f8);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0;
  white-space: nowrap;
}

.direct-grid > .ml-ad-top .site-card-name,
.direct-grid > .ml-ad-top .ml-ad-summary,
.ml-ad-card .site-card-name {
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.direct-grid > .ml-ad-top .ml-ad-summary {
  grid-column: 1 / -1;
  max-width: none;
  color: var(--muted, #667085);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
}

.ml-ad-top:focus-visible,
.ml-ad-card:focus-visible,
.context-links a.ml-ad-hub:focus-visible {
  outline: 2px solid var(--accent-dark, #9c1f4b);
  outline-offset: 2px;
}

.ml-ad-card .ml-ad-logo {
  width: 72px;
  height: 44px;
  padding: 3px;
  flex: 0 0 auto;
}

.ml-ad-card .site-card-desc {
  -webkit-line-clamp: unset;
  max-height: 140px;
}

body.hide-card-desc .ml-ad-card .site-card-desc {
  max-height: 0;
  margin-top: -4px;
  opacity: 0;
  visibility: hidden;
}

.context-links a.ml-ad-hub {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  column-gap: 12px;
  row-gap: 4px;
  align-items: center;
  min-width: 0;
}

.context-links a.ml-ad-hub .ml-ad-logo {
  grid-row: span 2;
  width: 96px;
  height: 56px;
  padding: 4px;
  border: 1px solid #e6e9f0;
  border-radius: 8px;
}

.context-links a.ml-ad-hub h3,
.context-links a.ml-ad-hub p {
  min-width: 0;
  overflow-wrap: anywhere;
}

.context-links a.ml-ad-hub h3 {
  margin: 0;
  color: #17212b;
  font-size: 16px;
  line-height: 1.35;
}

.context-links a.ml-ad-hub p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted, #667085);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
}

@media (max-width: 640px) {
  .direct-grid > .ml-ad-top {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 2px 6px;
    padding: 6px;
  }

  .direct-grid > .ml-ad-top .ml-ad-logo,
  .ml-ad-card .ml-ad-logo {
    width: 64px;
    height: 40px;
  }

  .direct-grid > .ml-ad-top .ml-ad-summary {
    font-size: 11px;
  }

  .ml-ad-card,
  .ml-ad-card .site-card-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .context-links a.ml-ad-hub {
    grid-template-columns: 72px minmax(0, 1fr);
    column-gap: 8px;
  }

  .context-links a.ml-ad-hub .ml-ad-logo {
    width: 72px;
    height: 42px;
  }
}
