/* Public-site media sizing: preserve the customer's editorial layouts.
   Distinct frame ratios prevent image squashing when flex/grid columns resize. */
body.fme-publication img { max-width: 100%; }
body.fme-publication :is(.zoom, .bn-img, .pg-hero-img, .conf-img, .gate-img) { min-width: 0; }
body.fme-publication .zoom img { display: block; object-fit: cover; }
body.fme-publication .logo img { object-fit: contain !important; }

/* Stable aspect ratios for article/research/gallery cards instead of fixed,
   incompatible inline pixel heights at different screen sizes. */
body[data-fme-page="index"] :is(.feat-img, .pimg, .rimg) {
  position: relative;
  aspect-ratio: 8 / 5;
  height: auto !important;
  min-height: 0;
  overflow: hidden;
}
body[data-fme-page="index"] :is(.feat-img, .pimg, .rimg) > img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}
body[data-fme-page="index"] .nthumb { overflow: hidden; }
body[data-fme-page="index"] .nthumb img { width: 100%; height: 100%; object-fit: cover; }
body[data-fme-page="hoi-nghi"] .gal .zoom,
body[data-fme-page="hoi-nghi"] .gal + div .zoom {
  position: relative;
  aspect-ratio: 8 / 5;
  height: auto !important;
  overflow: hidden;
}
body[data-fme-page="hoi-nghi"] .gal .zoom > img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

/* The original customer template stacks banner image and panel on mobile.
   Previous V10 overrides still forced a 340–345px banner height, clipping content. */
@media (max-width: 820px) {
  body[data-fme-page="index"] .bn {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }
  body[data-fme-page="index"] .bn-layer {
    position: relative !important;
    inset: auto !important;
    height: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
    transition: none !important;
  }
  body[data-fme-page="index"] .bn-layer:not(.on) { display: none !important; }
  body[data-fme-page="index"] .bn-layer.on { display: block !important; }
  body[data-fme-page="index"] .bn-img {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
    overflow: hidden;
  }
  body[data-fme-page="index"] .bn-img > img {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    animation: none !important;
  }
  body[data-fme-page="index"] .bn-panel {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    clip-path: none !important;
    padding: 22px 18px 88px !important;
  }
  body[data-fme-page="index"] .bn-ctl {
    left: 18px !important;
    bottom: 18px !important;
  }
  /* Student/faculty hero: turn the formerly overlaid image into a full-width
     frame rather than a squeezed 75%-width translucent strip. */
  body.fme-publication .pg-hero {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: hidden;
  }
  body.fme-publication .pg-hero-img {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 16 / 9;
    opacity: 1 !important;
    overflow: hidden;
  }
  body.fme-publication .pg-hero-img > img {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    animation: none !important;
  }
  body.fme-publication .pg-hero-txt {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    padding: 22px 18px 26px !important;
    clip-path: none !important;
  }
  body[data-fme-page="hoi-nghi"] .hero-in > .in {
    width: 100%;
    max-width: 100%;
    padding: 22px 18px !important;
    box-sizing: border-box;
    margin-top: 18px !important;
  }
  body[data-fme-page="hoi-nghi"] .hero-in h1 { font-size: clamp(23px, 5vw, 32px) !important; }
}
@media (max-width: 560px) {
  body[data-fme-page="index"] .bn-panel h1, body[data-fme-page="index"] .bn-panel h2 { font-size: clamp(21px, 5.3vw, 26px) !important; }
  body[data-fme-page="hoi-nghi"] .gal { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
  body[data-fme-page="hoi-nghi"] .hero-in { padding: 18px 16px 28px !important; }
  body[data-fme-page="index"] .bn-ctl { gap: 9px !important; }
  body[data-fme-page="index"] .bn-ctl button { flex-shrink: 0; }
}
@media (max-width: 390px) {
  body[data-fme-page="hoi-nghi"] .gal { grid-template-columns: 1fr !important; }
}

/* on phones the fixed admin shortcut crowds the chatbot bubble and covers
    content buttons at the bottom of the screen. The header already links to the
    same login page, so hide the floating shortcut below 560px. */
@media (max-width: 560px) {
  a[aria-label="Mở giao diện quản trị FME Portal"] { display: none !important; }
}
