body.single-post #site-main:has(+ #related-articles),
body.single-post #site-main:has(+ #related-articles) > .section:last-child {
  padding-bottom: 0;
}

.ojm-related-articles {
  padding: clamp(28px, 3vw, 44px) 0 clamp(38px, 6vw, 68px);
  background: #f7f6f2;
  color: #203b3b;
  scroll-margin-top: 140px;
}

.ojm-related-articles__shell {
  width: min(1200px, calc(100% - 64px));
}

#ojm-related-title {
  margin: 0 0 20px;
  color: #203b3b;
  font-size: clamp(1.5rem, 2.8vw, 2rem);
  line-height: 1.2;
}

.ojm-related-articles__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: clamp(12px, 2vw, 24px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.ojm-related-articles__list > li {
  min-width: 0;
}

.ojm-related-articles .ojm-related-articles__card {
  display: flex;
  box-sizing: border-box;
  height: 100%;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e0e6e1;
  border-radius: 12px;
  background: #fff;
  color: #203b3b;
  text-decoration: none;
}

.ojm-related-articles__image {
  display: block;
  flex: none;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #edefe9;
}

.ojm-related-articles__image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ojm-related-articles__content {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
}

.ojm-related-articles__title {
  font-size: clamp(.95rem, 1.4vw, 1.08rem);
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.ojm-related-articles__arrow {
  flex: none;
  color: #176459;
  font-size: 1.3rem;
}

.ojm-related-articles__card:hover .ojm-related-articles__title,
.ojm-related-articles__card:focus-visible .ojm-related-articles__title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ojm-related-articles__card:focus-visible,
body.single-post .ojm-inquiry-float:focus-visible {
  outline: 2px solid #176459;
  outline-offset: 3px;
}

@media (max-width: 600px) {
  .ojm-related-articles__shell {
    width: calc(100% - 40px);
  }

  .ojm-related-articles__list {
    grid-template-columns: minmax(0, 1fr);
  }

  .ojm-related-articles .ojm-related-articles__card {
    min-height: 88px;
    flex-direction: row;
  }

  .ojm-related-articles__image {
    position: relative;
    width: 96px;
    aspect-ratio: auto;
    align-self: stretch;
  }

  .ojm-related-articles__image img {
    position: absolute;
    inset: 0;
  }

  .ojm-related-articles__content {
    min-width: 0;
    padding: 11px 12px;
  }
}

body.single-post #site-main .article-sidebar-layout > .article-rfq[data-ojm-inquiry-layout] {
  position: static !important;
  top: auto !important;
  max-height: none !important;
  overflow: visible !important;
  align-self: start;
}

body.single-post #site-main .article-sidebar-layout > .article-rfq[data-ojm-inquiry-layout="sticky"] {
  position: sticky !important;
  top: var(--ojm-inquiry-top, 128px) !important;
}

body.single-post .ojm-inquiry-float {
  position: fixed;
  z-index: 40;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: max(16px, env(safe-area-inset-left));
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 999px;
  box-shadow: 0 6px 20px #112f2a26;
  background: #99591e;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
}

body.single-post .ojm-inquiry-float:hover {
  background: #794617;
}

body.single-post .ojm-inquiry-float[hidden] {
  display: none;
}

/* Article contact actions stay expanded when the sidebar form is visible. */
@media (min-width: 768px) {
  html body.single-post > .floating-contact-bar,
  html body.single-post[data-ojm-primary-inquiry] > .floating-contact-bar {
    display: grid !important;
  }

  html body.single-post > .floating-contact-bar > .floating-contact-link:not(.floating-contact-top),
  html body.single-post[data-ojm-primary-inquiry] > .floating-contact-bar > .floating-contact-link:not(.floating-contact-top) {
    display: grid !important;
  }

  html body.single-post[data-ojm-primary-inquiry] > .floating-actions {
    display: flex !important;
  }
}

/* On desktop the inquiry rail also runs alongside the related articles. */
body.single-post #site-main:has([data-ojm-related-rail]),
body.single-post #site-main:has([data-ojm-related-rail]) > .section:last-child {
  padding-bottom: 0;
}

body.single-post #site-main .article-sidebar-layout[data-ojm-related-rail] {
  row-gap: 0;
}

body.single-post #site-main .article-sidebar-layout[data-ojm-related-rail] > :is(article, .ojm-inquiry-article-content) {
  grid-area: 1 / 1;
}

body.single-post #site-main .article-sidebar-layout[data-ojm-related-rail] > .article-rfq {
  grid-area: 1 / 2 / span 2;
}

body.single-post #site-main .article-sidebar-layout[data-ojm-related-rail] > .ojm-related-articles {
  grid-area: 2 / 1;
  min-width: 0;
  background: transparent;
}

body.single-post #site-main .article-sidebar-layout[data-ojm-related-rail] .ojm-related-articles__shell {
  width: 100%;
}

body.single-post #site-main .article-sidebar-layout > .article-rfq[data-ojm-inquiry-layout="related"] {
  position: fixed !important;
  top: var(--ojm-inquiry-top) !important;
  left: var(--ojm-inquiry-left);
  width: var(--ojm-inquiry-width);
  box-sizing: border-box;
  z-index: 12;
}

@media (min-width: 981px) and (max-height: 720px),
       (min-width: 981px) and (max-width: 1100px) and (max-height: 850px) {
  body.single-post #site-main .article-sidebar-layout > .article-rfq[data-ojm-inquiry-layout] {
    padding: 12px !important;
  }

  body.single-post #site-main .article-sidebar-layout > .article-rfq[data-ojm-inquiry-layout] > h2 {
    font-size: 18px !important;
    line-height: 1.2 !important;
  }

  body.single-post #site-main .article-sidebar-layout > .article-rfq[data-ojm-inquiry-layout] > .ojsite-form {
    gap: 6px !important;
    margin-top: 8px !important;
  }

  body.single-post #site-main .article-sidebar-layout > .article-rfq[data-ojm-inquiry-layout] .ojsite-form textarea {
    height: 84px !important;
    min-height: 84px !important;
  }
}

.ojm-added-inquiry-layout > :is(article, .ojm-inquiry-article-content) {
  min-width: 0;
}

.ojm-inquiry-preparation {
  margin-block: 10px;
}

.ojm-inquiry-preparation > summary {
  color: #245348;
  font-size: .875rem;
  font-weight: 650;
  cursor: pointer;
}

/* Let the rail release its desktop grid areas before measuring a mobile resize. */
@media (max-width: 980px) {
  body.single-post #site-main .article-sidebar-layout[data-ojm-related-rail] > :is(article, .ojm-inquiry-article-content, .article-rfq, .ojm-related-articles) {
    grid-area: auto;
  }
}

@media (max-width: 1000px) {
  body.single-post #site-main :is(.mc24-page-grid, .mount308-page-grid)[data-ojm-related-rail] > :is(article, .article-rfq, .ojm-related-articles) {
    grid-area: auto;
  }
}
