/* SizeRoute right advertising rail — three reserved placements on every page. */
:root {
  --sr-ad-rail-width: 292px;
  --sr-ad-rail-gap: 14px;
}

.sr-right-ad-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sr-ad-rail-gap);
  width: 100%;
  min-width: 0;
  align-content: start;
}

.sr-right-ad {
  display: flex;
  min-width: 0;
  min-height: 250px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(118, 111, 98, 0.28);
  border-radius: 14px;
  background: #fffefa;
  box-shadow: 0 4px 16px rgba(25, 32, 38, 0.045);
  contain: layout paint;
}

.sr-right-ad-label {
  padding: 7px 10px 6px;
  border-bottom: 1px solid rgba(118, 111, 98, 0.16);
  color: #766f62;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
}

.sr-right-ad-frame {
  display: grid;
  min-height: 219px;
  flex: 1;
  place-items: center;
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(169, 121, 53, 0.035), transparent 48%),
    #faf8f2;
  color: #7b7468;
  text-align: center;
}

.sr-right-ad-frame span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(118, 111, 98, 0.38);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 11px;
  font-weight: 750;
}

/* Converter pages: content, guidance cards, then ads on the physical right. */
@media (min-width: 1320px) {
  .site-shell:has(.sr-desktop-layout > .sr-right-ad-stack) {
    width: min(1418px, calc(100% - 24px));
  }

  .sr-desktop-layout:has(> .sr-right-ad-stack) {
    grid-template-columns:
      minmax(0, var(--converter-column, 790px))
      var(--sidebar-column, 292px)
      var(--sr-ad-rail-width);
    gap: var(--layout-gap, 22px);
  }

  .sr-desktop-layout > .sr-right-ad-stack {
    position: sticky;
    top: 82px;
  }
}

/* Keep the advertising rail on the physical right in Arabic as well. */
html[dir="rtl"] .sr-desktop-layout:has(> .sr-right-ad-stack),
html[dir="rtl"] .sr-page-ad-layout {
  direction: ltr;
}

html[dir="rtl"] .sr-desktop-layout:has(> .sr-right-ad-stack) > *,
html[dir="rtl"] .sr-page-ad-layout > * {
  direction: rtl;
}

/* Medium desktops keep guidance beside the converter and ads below both. */
@media (min-width: 1160px) and (max-width: 1319px) {
  .sr-desktop-layout > .sr-right-ad-stack {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 280px));
    justify-content: center;
    width: 100%;
    margin-top: 2px;
  }
}

/* Standalone content pages receive a balanced content + advertising layout. */
@media (min-width: 1320px) {
  .sr-page-ad-layout {
    display: grid;
    grid-template-columns: minmax(0, 980px) var(--sr-ad-rail-width);
    gap: 22px;
    width: min(1294px, calc(100% - 32px));
    margin: 0 auto;
    align-items: start;
  }

  .sr-page-ad-layout > main {
    width: 100% !important;
    min-width: 0;
    margin-inline: 0 !important;
  }

  .sr-page-ad-layout > .sr-right-ad-stack {
    position: sticky;
    top: 18px;
    padding-top: 16px;
  }
}

/* Below rail width, retain all three placements after the page content. */
@media (max-width: 1319px) {
  .sr-page-ad-layout {
    display: block;
  }

  .sr-page-ad-layout > .sr-right-ad-stack {
    width: min(var(--sr-ad-rail-width), calc(100% - 28px));
    margin: 24px auto 0;
  }
}

@media (max-width: 1159px) {
  .sr-desktop-layout > .sr-right-ad-stack {
    display: block;
    width: min(var(--sr-ad-rail-width), calc(100% - 28px));
    margin: 24px auto 0;
  }

  .sr-desktop-layout > .sr-right-ad-stack > * + * {
    margin-top: var(--sr-ad-rail-gap);
  }
}

/* On phones, the same three reserved units become compact responsive banners. */
@media (max-width: 599px) {
  .sr-right-ad,
  .sr-right-ad-frame {
    min-height: 100px;
  }

  .sr-right-ad-frame {
    min-height: 69px;
  }

  .sr-right-ad-frame span {
    min-height: 30px;
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sr-right-ad-stack {
    scroll-behavior: auto;
  }
}
