/* ==========================================================================
   RB Meta Ads Types — own stylesheet (rb-meta-ads.css)
   Same layout engine as RB Google Ads Types (numbered row list on the left,
   dark detail panel on the right, accordion below the stack breakpoint) with
   Meta-specific visuals: feed ad preview, Stories / Reels frames, carousel
   cards, percentage bars and a retargeting funnel.
   ========================================================================== */

.rbma{
  --rbma-list-w:49%;
  --rbma-gap:16px;
  --rbma-row-gap:8px;
  --rbma-dur:450ms;
  position:relative;
  width:100%;
  background-color:#F4F7FB;
  color:#0E1A2B;
}
.rbma *{box-sizing:border-box}
.rbma__inner{max-width:1440px;margin:0 auto;padding:72px 16px}
.rbma__header{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:48px;margin-bottom:40px}
.rbma__heading{margin:0;max-width:12ch;color:#0E1A2B;font-size:clamp(40px,6vw,84px);font-weight:800;line-height:.92;letter-spacing:-.055em}
.rbma__intro{margin:0;max-width:350px;color:#526174;font-size:16px;line-height:1.6}

/* Side-by-side: rows in column 1 (one grid row each), every panel spans all rows in column 2.
   The last 1fr row absorbs extra height when the panel is taller than the list. */
.rbma__body{
  display:grid;
  grid-template-columns:var(--rbma-list-w) minmax(0,1fr);
  grid-template-rows:repeat(var(--rbma-n,5),auto) 1fr;
  column-gap:var(--rbma-gap);
  row-gap:var(--rbma-row-gap);
  align-items:start;
}
.rbma__tabs,.rbma__panels{display:contents}

.rbma .rbma__tab{
  grid-column:1;
  grid-row:var(--rbma-row);
  -webkit-appearance:none;
  appearance:none;
  display:flex;
  align-items:center;
  width:100%;
  min-height:62px;
  margin:0;
  padding:16px 22px 16px 18px;
  border:1px solid #E3E9F2;
  border-radius:14px;
  background-color:#FFFFFF;
  color:#0E1A2B;
  font:inherit;
  text-align:left;
  text-decoration:none;
  text-transform:none;
  letter-spacing:normal;
  box-shadow:none;
  cursor:pointer;
  transition:background-color .25s ease,color .25s ease,border-color .25s ease,box-shadow .25s ease;
}
.rbma .rbma__tab:hover,.rbma .rbma__tab:focus{color:inherit;text-decoration:none}
.rbma .rbma__tab:focus{outline:none}
.rbma .rbma__tab:focus-visible{outline:2px solid #F59A00;outline-offset:2px}
.rbma .rbma__tab-num{flex:none;width:44px;color:#68778A;font-size:11px;font-weight:600;line-height:1;transition:color .25s ease}
.rbma .rbma__tab-title{flex:1;min-width:0;font-size:24px;font-weight:800;line-height:1.1;letter-spacing:-.035em}
.rbma .rbma__tab-arrow{flex:none;width:16px;height:auto;margin-left:12px;color:#0E1A2B;transition:transform .25s ease,color .25s ease}
.rbma .rbma__tab.is-active{background-color:#030A17;border-color:#030A17;color:#FFFFFF}
.rbma .rbma__tab.is-active .rbma__tab-num{color:#8E9CB0}
.rbma .rbma__tab.is-active .rbma__tab-arrow{color:#FFFFFF;transform:translateX(3px)}

.rbma__panel{
  grid-column:2;
  grid-row:1 / -1;
  align-self:stretch;
  display:flex;
  flex-direction:column;
  min-width:0;
  min-height:420px;
  padding:32px;
  border-radius:28px;
  background-color:#030A17;
  color:#FFFFFF;
  overflow:hidden;
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transition:opacity var(--rbma-dur) ease,transform var(--rbma-dur) cubic-bezier(.2,.8,.2,1),visibility 0s linear var(--rbma-dur);
}
.rbma[data-anim="fade-up"] .rbma__panel{transform:translateY(12px)}
.rbma__panel.is-active{opacity:1;visibility:visible;pointer-events:auto;transform:none!important;transition-delay:0s}
.rbma[data-anim="none"] .rbma__panel{transition:none}
.rbma__panel-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}
.rbma__title{margin:0;color:#FFFFFF;font-size:36px;font-weight:800;line-height:1.05;letter-spacing:-.045em}
.rbma__badge{flex:none;margin-top:4px;padding:7px 12px;border-radius:99px;background-color:#2A1A06;color:#F59A00;font-size:11px;font-weight:700;line-height:1.2;white-space:nowrap}
.rbma__desc{margin:18px 0 0;max-width:440px;color:#C3CCDA;font-size:15px;line-height:1.55}
.rbma__visual{margin-top:48px}

/* Visual: search ad + keyword chips */
.rbma-ad{padding:14px 16px;border-radius:16px;background-color:#FFFFFF;color:#0E1A2B}
.rbma-ad__top{color:#68778A;font-size:11px;line-height:1.3}
.rbma-ad__label{color:#0E1A2B;font-weight:700}
.rbma-ad__headline{margin-top:4px;color:#14254A;font-size:16px;font-weight:600;line-height:1.3}
.rbma-ad__desc{margin-top:2px;color:#68778A;font-size:12px;line-height:1.4}
.rbma-chips{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
.rbma-chip{display:inline-flex;align-items:center;padding:7px 12px;border-radius:99px;font-size:11px;font-weight:600;line-height:1.2}
.rbma-chip--pos{background-color:#0D3328;color:#34C38F}
.rbma-chip--neg{background-color:#3A1219;color:#F0525F}

/* Visual: product cards */
.rbma-products{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.rbma-product{min-width:0;padding:6px 6px 10px;border-radius:14px;background-color:#FFFFFF;color:#0E1A2B}
.rbma-product__img{
  --rbma-stripe:#E2E8F2;
  position:relative;
  aspect-ratio:1 / 1;
  overflow:hidden;
  border-radius:10px;
  background:repeating-linear-gradient(135deg,var(--rbma-stripe) 0 9px,#EEF2F8 9px 18px);
}
.rbma-product__img img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.rbma-product__name{margin:8px 3px 0;color:#0E1A2B;font-size:10px;line-height:1.3;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.rbma-product__price{margin:5px 3px 0;color:#0E1A2B;font-size:13px;font-weight:800;line-height:1.2}

/* Visual: percentage bars */
.rbma-bars{--rbma-bar-label:72px;display:grid;gap:12px}
.rbma-bar{display:grid;grid-template-columns:var(--rbma-bar-label) minmax(0,1fr) 44px;align-items:center;gap:14px;font-size:12px;font-weight:500;line-height:1.2}
.rbma-bar__label{color:#FFFFFF;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.rbma-bar__track{position:relative;display:block;height:8px;border-radius:99px;background-color:#1B2333;overflow:hidden}
.rbma-bar__fill{position:absolute;left:0;top:0;bottom:0;width:var(--w);border-radius:inherit;background-color:#6B7489}
.rbma-bar.is-hi .rbma-bar__fill{background-color:#E8890C}
.rbma-bar__value{color:#E9EDF3;text-align:right}
.rbma[data-animate="1"] .rbma-bar__fill{width:0;transition:width .9s cubic-bezier(.2,.8,.2,1) var(--d,0ms)}
.rbma[data-animate="1"] .rbma__panel.is-active .rbma-bar__fill{width:var(--w)}

/* Visual: video ad frame */
.rbma-yt{
  --rbma-stripe:#1C2742;
  position:relative;
  height:260px;
  overflow:hidden;
  border-radius:16px;
  background-color:#141C30;
  background-image:repeating-linear-gradient(135deg,var(--rbma-stripe) 0 16px,transparent 16px 32px);
  color:#FFFFFF;
}
.rbma-yt__bg{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.rbma-yt__badge{position:absolute;top:12px;left:12px;padding:6px 10px;border-radius:99px;background-color:#F5A524;color:#0E1A2B;font-size:10px;font-weight:800;line-height:1;letter-spacing:.02em}
.rbma-yt__skip{position:absolute;right:12px;bottom:44px;padding:9px 14px;border-radius:99px;background-color:#0B1220;color:#FFFFFF;font-size:11px;font-weight:700;line-height:1}
.rbma-yt__stats{position:absolute;left:12px;bottom:16px;display:flex;gap:14px;color:#C3CCDA;font-size:11px;line-height:1}
.rbma-yt__stats strong{color:#FFFFFF;font-weight:800}
.rbma-yt__progress{position:absolute;left:0;right:0;bottom:0;height:4px;background-color:rgba(255,255,255,.18)}
.rbma-yt__progress-fill{position:absolute;left:0;top:0;bottom:0;width:var(--p);background-color:#F5A524}
.rbma[data-animate="1"] .rbma-yt__progress-fill{width:0;transition:width 1.2s cubic-bezier(.2,.8,.2,1) .15s}
.rbma[data-animate="1"] .rbma__panel.is-active .rbma-yt__progress-fill{width:var(--p)}

/* Visual: numbered rows */
.rbma-funnel{display:grid;gap:6px}
.rbma-row{display:grid;grid-template-columns:36px minmax(0,1fr) auto;align-items:center;gap:8px;padding:10px 14px;border-radius:12px;background-color:#111826;color:#FFFFFF;font-size:12px;font-weight:500;line-height:1.3}
.rbma-row__num,.rbma-row__value{font-weight:800}
.rbma-row.is-hi{background-color:#E8820C;color:#0E1A2B}

/* Visual: uploaded image / video */
.rbma-media{position:relative;overflow:hidden;aspect-ratio:16 / 9;border-radius:16px;background-color:#111826}
.rbma-media img,.rbma-media video,.rbma-media iframe{position:absolute;inset:0;width:100%;height:100%;border:0;object-fit:cover;display:block}

/* Accordion (small screens): JS adds .is-stacked; each panel opens under its row. */
.rbma.is-stacked .rbma__body{grid-template-columns:minmax(0,1fr);grid-template-rows:none}
.rbma.is-stacked .rbma .rbma__tab,.rbma.is-stacked .rbma__tab{grid-row:auto;grid-column:1;order:calc(var(--rbma-row) * 2)}
.rbma.is-stacked .rbma__panel{grid-row:auto;grid-column:1;order:calc(var(--rbma-row) * 2 + 1);display:none;min-height:0}
.rbma.is-stacked .rbma__panel.is-active{display:flex}
@media(max-width:1024px){
  .rbma__header{grid-template-columns:minmax(0,1fr);gap:20px}
}
@media(max-width:767px){
  .rbma__inner{padding:52px 16px}
  .rbma__heading{font-size:clamp(36px,11vw,54px)}
  .rbma__panel{padding:24px;border-radius:22px}
  .rbma__title{font-size:28px}
  .rbma__visual{margin-top:28px}
  .rbma-products{grid-template-columns:repeat(2,minmax(0,1fr))}
  .rbma-yt{height:200px}
}
@media(prefers-reduced-motion:reduce){
  .rbma__panel,.rbma-bar__fill,.rbma-yt__progress-fill{transition:none!important}
}

/* --------------------------------------------------------------------------
   Works before / without JavaScript.
   The two-column grid is unusable on a phone, and the accordion layout used
   to depend on JS adding .is-stacked — so if a cache plugin delayed the
   script the rows stayed squashed into a 49% column. This stacks from CSS
   alone until the script mounts and adds .rbma--ready, after which the
   configured breakpoint takes over.
   -------------------------------------------------------------------------- */
@media (max-width:1024px){
  .rbma:not(.rbma--ready) .rbma__body{grid-template-columns:minmax(0,1fr);grid-template-rows:none}
  .rbma:not(.rbma--ready) .rbma__tab{grid-row:auto;grid-column:1;order:calc(var(--rbma-row) * 2)}
  .rbma:not(.rbma--ready) .rbma__panel{grid-row:auto;grid-column:1;order:calc(var(--rbma-row) * 2 + 1);display:none;min-height:0}
  .rbma:not(.rbma--ready) .rbma__panel.is-active{display:flex}
}

/* ---------- Feed ad preview (Feed Ads) ---------- */
.rbma-feed{background-color:#FFFFFF;border-radius:14px;padding:12px}
.rbma-feed__top{display:flex;align-items:center;gap:10px}
.rbma-feed__top{align-items:flex-start}
.rbma-feed__av{flex:none;width:76px;height:76px;border-radius:12px;background-color:#E8EDF6;background-image:repeating-linear-gradient(135deg,#DCE4F2 0 6px,#EDF1F8 6px 12px)}
.rbma-feed__who{display:block;flex:1;min-width:0}
.rbma-feed__brand{display:block;color:#14254A;font-size:12px;font-weight:700;line-height:1.3}
.rbma-feed__brand span{color:#68778A;font-weight:500}
.rbma-feed__headline{display:block;margin-top:3px;color:#14254A;font-size:15px;font-weight:700;line-height:1.3}
.rbma-feed__sub{display:block;margin-top:3px;color:#68778A;font-size:12px;line-height:1.4}

/* ---------- Stories / Reels frames ---------- */
.rbma-stories{display:grid;grid-template-columns:repeat(var(--rbma-stories-n,3),minmax(0,1fr));gap:12px}
.rbma-story{display:flex;flex-direction:column;min-width:0}
.rbma-story__frame{
  position:relative;aspect-ratio:9 / 16;border-radius:14px;overflow:hidden;
  background-color:#1B2435;
  background-image:repeating-linear-gradient(135deg,rgba(255,255,255,.055) 0 8px,rgba(255,255,255,.015) 8px 16px);
  border:1px solid transparent;
}
.rbma-story.is-hi .rbma-story__frame{border-color:#F59A00;box-shadow:0 0 0 1px #F59A00}
.rbma-story__img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.rbma-story__cap{position:absolute;left:8px;right:8px;top:8px;padding:6px 8px;border-radius:8px;background-color:rgba(8,13,24,.72);color:#FFFFFF;font-size:11px;font-weight:700;line-height:1.25}
.rbma-story__play{position:absolute;left:50%;top:50%;width:32px;height:32px;margin:-16px 0 0 -16px;border-radius:50%;background-color:rgba(255,255,255,.18)}
.rbma-story__play:after{content:"";position:absolute;left:12px;top:9px;border-left:11px solid #FFFFFF;border-top:7px solid transparent;border-bottom:7px solid transparent}
.rbma-story__meta{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin-top:9px}
.rbma-story__label{color:#8E9CB0;font-size:11px;line-height:1.2}
.rbma-story__value{color:#FFFFFF;font-size:12px;font-weight:700;line-height:1.2}
.rbma-story.is-hi .rbma-story__value{color:#F59A00}

@media(max-width:767px){
  .rbma-stories{grid-template-columns:repeat(var(--rbma-stories-n,3),minmax(0,1fr));gap:8px}
  .rbma-story__cap{font-size:10px;padding:5px 6px}
}

/* --------------------------------------------------------------------------
   The two-column layout relies on display:contents to lift the rows and the
   panels into the same grid. If that declaration is ever dropped — an older
   browser, an aggressive CSS optimiser, a theme reset — the rows would land in
   one cell and the section would read as broken. This stacks it instead, which
   is always legible.
   -------------------------------------------------------------------------- */
@supports not (display: contents){
  .rbma__body{display:block}
  .rbma__tabs{display:grid;gap:var(--rbma-row-gap)}
  .rbma__panels{display:block;margin-top:var(--rbma-row-gap)}
  .rbma__tab{grid-row:auto;grid-column:auto}
  .rbma__panel{grid-row:auto;grid-column:auto;display:none;min-height:0}
  .rbma__panel.is-active{display:flex}
}
