/* CID Media Referenser – consolidated stylesheet; candidate, not production verified. */
/* CID Referenser: scoped TEST-only layout rules. Does not change ACF data or AIFE saving. */
/* The migrated v10 sections were reinserted without the original .container wrapper. */
body.page .cid-v10-legacy {
  width: 100% !important;
  max-width: 1200px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 24px !important;
  padding-right: 24px !important;
  box-sizing: border-box !important;
}
body.page .cid-v10-legacy .aife-sb-row,
body.page .cid-v10-legacy .aife-sb-col,
body.page .cid-v10-legacy .aife-sb-element { min-width: 0; max-width: 100%; box-sizing: border-box; }
/* Preserve the intended four-column desktop structure. */
body.page .cid-v10-legacy .cid-v10-principles { width:100%; max-width:100%; }
/* Never crop the supplied website presentation artworks. */
body.page .cid-dynamic-references .case .media,
body.page .cid-dynamic-references .case .media > * { min-width:0; max-width:100%; }
body.page .cid-dynamic-references .case .media img {
  display:block; max-width:100%; width:100%; height:auto !important;
  min-height:0 !important; object-fit:contain !important; object-position:center !important;
}
/* Constrain video embeds to the content width on phones and desktops. */
body.page .production-grid,
body.page .production-card,
body.page .production-media,
body.page .production-body,
body.page .filmgrid,
body.page .filmcard { min-width:0; max-width:100%; box-sizing:border-box; }
body.page .production-card iframe,
body.page .filmcard iframe,
body.page .production-media iframe,
body.page .production-body iframe,
body.page .cid-dynamic-films iframe,
body.page .production-card video,
body.page .filmcard video,
body.page .production-media video {
  display:block; width:100% !important; max-width:100% !important;
  height:auto; aspect-ratio:16/9; box-sizing:border-box;
}
body.page .production-card img,
body.page .filmcard img,
body.page .production-media img { max-width:100%; height:auto !important; object-fit:contain !important; }
@media (max-width:800px) {
  body.page .cid-v10-legacy { padding-left:20px !important; padding-right:20px !important; }
  body.page .cid-v10-legacy .cid-v10-principles { grid-template-columns:minmax(0,1fr) !important; }
  body.page .cid-dynamic-references .case-featured .media { grid-template-columns:minmax(0,1fr) !important; }
  body.page .cid-dynamic-references .compact-grid,
  body.page .cid-dynamic-films,
  body.page .production-grid { grid-template-columns:minmax(0,1fr) !important; }
  body.page .cid-dynamic-references .case .media img { aspect-ratio:auto !important; }
  body.page .production-card iframe,
  body.page .filmcard iframe,
  body.page .production-media iframe,
  body.page .production-body iframe { min-width:0 !important; }
}

/* CID Referenser / AIFE Section Builder video containment — test environment only. */
@media (max-width: 800px) {
  body.page .aife-sb-row,
  body.page .aife-sb-col,
  body.page .aife-sb-element,
  body.page .aife-sb-el-video,
  body.page .aife-sb-video-wrap {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  body.page .aife-sb-el-video,
  body.page .aife-sb-video-wrap {
    width: 100% !important;
    overflow: hidden !important;
  }
  body.page .aife-sb-el-video iframe,
  body.page .aife-sb-video-wrap iframe,
  body.page .aife-sb-el-video video,
  body.page .aife-sb-video-wrap video {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    aspect-ratio: 16 / 9 !important;
    margin: 0 !important;
    position: static !important;
    transform: none !important;
    box-sizing: border-box !important;
  }
}

/* Testad i Extra CSS på aife-test.cidmedia.se; endast mobil och kompaktkort. */
@media (max-width: 767px) {
  .refs .cid-dynamic-list .compact-grid .media.one img {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    object-fit: contain !important;
  }
}
