/* Measured advertising lanes and one mobile dock that yields to tool controls. */
body[data-site-ads="triad-v1"] .site-ad-band {
  box-sizing: border-box;
  display: block;
  width: min(100%, var(--site-ad-lane-width, 100%));
  max-width: calc(100vw - 4px);
  min-width: 0;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  position: relative;
  isolation: isolate;
  overflow: visible;
}
body[data-site-ads="triad-v1"] .site-ad-band:not(.site-ad-band--mobile-bottom)[data-ad-reserved="1"] {
  margin-block: 14px;
  row-gap: 12px;
}
body[data-site-ads="triad-v1"] .site-ad-slot {
  box-sizing: border-box;
  position: absolute;
  inset-inline-start: auto;
  left: var(--site-ad-x, 0px);
  top: var(--site-ad-y, 0px);
  width: var(--site-ad-width);
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 0;
}
body[data-site-ads="triad-v1"] .site-ad-slot[data-ad-fits="0"] { display: none; }
body[data-site-ads="triad-v1"] .site-ad-slot--native {
  flex: 1 1 300px;
  width: 100%;
}
body[data-site-ads="triad-v1"] .site-ad-host {
  width: 100%;
  min-height: 1px;
  margin: 0;
  padding: 0;
  display: block;
}
body[data-site-ads="triad-v1"] .site-ad-label {
  margin: 0 0 5px;
  color: #63716b;
  font-size: 11px;
  line-height: 1.3;
  letter-spacing: .04em;
  text-align: center;
}
body[data-site-ads="triad-v1"] .site-ad-slot[hidden],
body[data-site-ads="triad-v1"] .site-ad-label[hidden] { display: none !important; }
/* Reserve the real caption box while pending, without exposing its text.
 * Packed slot measurements include it exactly once; the fixed dock retains
 * its existing geometry and collision handling. Hidden/no-fit slots collapse. */
body[data-site-ads="triad-v1"] .site-ad-band:not(.site-ad-band--mobile-bottom)
  .site-ad-slot[data-ad-reserved="1"] > .site-ad-label[hidden] {
  display: block !important;
  visibility: hidden;
}
body[data-site-ads="triad-v1"] .site-ad-band--settings { align-self: start; }
@media (max-width: 760px) {
  body[data-site-ads="triad-v1"] .site-ad-band {
    width: var(--site-ad-lane-width, 100%);
    max-width: none;
    margin-inline-start: calc((100% - var(--site-ad-lane-width, 100%)) / 2);
    margin-inline-end: 0;
  }
}
/* Match the existing ordered shell and mobile display:contents workflow. */
body[data-site-ads="triad-v1"] .frame > .site-ad-band--top { order: 2; }
body[data-site-ads="triad-v1"] .frame > .site-ad-band--footer { order: 8; }
body[data-site-ads="triad-v1"] .right > .site-ad-band--rail { order: 9; }
@media (max-width: 980px) {
  body[data-site-ads="triad-v1"] .app > .left > .site-ad-band--top { order: 3; }
  body[data-site-ads="triad-v1"] .app > .left > .site-ad-band--preview { order: 5; }
}
body[data-site-ads="triad-v1"] .frame-body .app > .right > .options {
  position: static;
  top: auto;
}
body[data-site-ads="triad-v1"] .site-ad-stack {
  display: contents;
}
body[data-site-ads="triad-v1"] .site-ad-stack > .site-ad-slot { flex: 0 0 auto; }
body[data-site-ads="triad-v1"] .site-ad-stack:not(:has(> :not([hidden]))) { display: none; }
@media (max-width: 980px) {
  body[data-site-ads="triad-v1"] .app > .left > .site-ad-band--reading { order: 6; }
}

/* A 300px issued banner must fit inside the clipped home hero at 320px. */
@media (max-width: 323px) {
  body[data-page="home"][data-site-ads="triad-v1"] .page {
    padding-inline: 10px;
  }
}

/* Use only measured free outer margins; keep the existing center at its full width.
   On a narrower window, the same hosts become ordinary rows after the content. */
body[data-site-ads="triad-v1"] .page.has-site-ad-outer-rails {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  justify-items: center;
  column-gap: 14px;
}
body[data-site-ads="triad-v1"] .page.has-site-ad-outer-rails > .frame {
  grid-column: 1;
  grid-row: 1;
}
body[data-site-ads="triad-v1"] .page.has-site-ad-outer-rails > .site-ad-band {
  grid-column: 1;
  grid-row: auto;
  align-self: start;
}
body[data-site-ads="triad-v1"] .page[data-site-ad-outer-fit="1"] {
  grid-template-columns: minmax(160px, 1fr) var(--site-ad-center-width) minmax(160px, 1fr);
}
body[data-site-ads="triad-v1"] .page[data-site-ad-outer-fit="1"] > .frame {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
}
body[data-site-ads="triad-v1"] .page[data-site-ad-outer-fit="1"] > .site-ad-band--outer-start {
  grid-column: 1;
  grid-row: 1;
}
body[data-site-ads="triad-v1"] .page[data-site-ad-outer-fit="1"] > .site-ad-band--outer-end {
  grid-column: 3;
  grid-row: 1;
}
@media (min-height: 680px) {
  body[data-site-ads="triad-v1"] .page[data-site-ad-outer-fit="1"] > .site-ad-band[data-site-ad-sticky="1"] {
    position: sticky;
    top: 24px;
  }
}

/* The issued Ero native widget uses two compact rows of two cards. */
body[data-site-ads="triad-v1"] .site-ero-grid { width: 100%; }
body[data-site-ads="triad-v1"] .site-ero-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 8px;
}
body[data-site-ads="triad-v1"] .site-ero-card {
  min-width: 0;
  font-size: 12px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
body[data-site-ads="triad-v1"] .site-ero-card a,
body[data-site-ads="triad-v1"] .site-ero-card .title,
body[data-site-ads="triad-v1"] .site-ero-card .displayurl { display: block; }
body[data-site-ads="triad-v1"] .site-ero-card img {
  display: block;
  max-width: 100%;
  height: auto;
  margin-block: 4px;
}

/* One original 320x50 mobile banner, outside the upload/reading flow. */
body[data-site-ads="triad-v1"] .site-ad-band--mobile-bottom { display: none; }
@media (max-width: 760px) {
  body[data-site-ads="triad-v1"] .site-ad-band--top { display: none; }
  body[data-site-ads="triad-v1"] .site-ad-band--mobile-bottom {
    display: block;
    position: fixed;
    z-index: 40;
    left: 50%;
    bottom: env(safe-area-inset-bottom, 0px);
    width: 320px;
    max-width: calc(100vw - 16px);
    margin: 0;
    transform: translateX(-50%);
  }
  body[data-site-ads="triad-v1"] .site-ad-band--mobile-bottom.has-ads {
    margin: 0;
    background: #f8faf8;
    box-shadow: 0 -2px 12px #15231d18;
    border-radius: 6px 6px 0 0;
  }
  body[data-site-ads="triad-v1"] .site-ad-band--mobile-bottom[data-site-ad-dock-suspended="1"] {
    visibility: hidden;
    pointer-events: none;
  }
  body.has-site-ad-mobile-dock {
    padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  }
  html { scroll-padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
}
