/* FrameWork R11.1: adaptive, horizontal logo + product credit.
   Overrides layout only; no changes to logos, menus, permissions or theme. */

/* Both static-screen and designer headers: leave enough space for a logo
   with its own aspect ratio, then flow credit directly after its true width. */
#fw-r11-header .fw-r11-brand,
.topbar.fw-r11-designer .topbar-logo-wrap {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: clamp(9px, .95vw, 16px) !important;
  width: max-content !important;
  min-width: 0 !important;
  max-width: min(620px, 51vw) !important;
  flex: 0 1 auto !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  text-align: left !important;
}

#fw-r11-header .fw-r11-brand > img,
.topbar.fw-r11-designer .topbar-logo-wrap > img.topbar-logo-img {
  display: block !important;
  width: auto !important;
  height: auto !important;
  max-height: 56px !important;
  max-width: min(310px, 26vw) !important;
  min-width: 0 !important;
  object-fit: contain !important;
  object-position: left center !important;
  flex: 0 1 auto !important;
  border: 0 !important;
}

#fw-r11-header .fw-r11-credit,
.topbar.fw-r11-designer .topbar-logo-wrap > .fw-r11-credit,
.topbar.fw-r11-designer .topbar-logo-wrap > .header-sub {
  display: block !important;
  position: static !important;
  flex: 0 1 auto !important;
  align-self: flex-end !important;
  margin: 0 0 5px !important;
  padding: 0 !important;
  min-width: 0 !important;
  max-width: 265px !important;
  width: auto !important;
  color: #e8eff9 !important;
  font-family: 'Segoe UI', Arial, sans-serif !important;
  font-size: clamp(11px, 0.94vw, 14px) !important;
  line-height: 1.23 !important;
  font-weight: 400 !important;
  font-style: italic !important;
  letter-spacing: normal !important;
  text-align: left !important;
  white-space: normal !important;
  text-overflow: clip !important;
  overflow: visible !important;
}

/* The legacy Designer's label is a direct sibling of the logo block.
   R11 already creates a credit INSIDE that block. Hide only the duplicate. */
.topbar.fw-r11-designer > .header-sub { display: none !important; }

/* Original header controls stay behind the menu actions, no shift. */
.topbar.fw-r11-designer { align-items: center !important; }
#fw-r11-header .fw-r11-menubar,
.topbar.fw-r11-designer .fw-r11-menubar {
  margin-left: auto !important;
}

/* Tight windows: logo shrinks proportionally; credit follows naturally. */
@media (max-width: 1160px) {
  #fw-r11-header .fw-r11-brand,
  .topbar.fw-r11-designer .topbar-logo-wrap { max-width: min(500px, 51vw) !important; gap: 8px !important; }
  #fw-r11-header .fw-r11-brand > img,
  .topbar.fw-r11-designer .topbar-logo-wrap > img.topbar-logo-img { max-width: min(220px, 24vw) !important; max-height: 50px !important; }
  #fw-r11-header .fw-r11-credit,
  .topbar.fw-r11-designer .topbar-logo-wrap > .fw-r11-credit { font-size: 11px !important; max-width: 215px !important; }
}

@media (max-width: 780px) {
  #fw-r11-header,
  .topbar.fw-r11-designer { flex-wrap: wrap !important; }
  #fw-r11-header .fw-r11-brand,
  .topbar.fw-r11-designer .topbar-logo-wrap { max-width: calc(100vw - 35px) !important; }
  #fw-r11-header .fw-r11-brand > img,
  .topbar.fw-r11-designer .topbar-logo-wrap > img.topbar-logo-img { max-width: min(220px, 39vw) !important; }
  #fw-r11-header .fw-r11-menubar,
  .topbar.fw-r11-designer .fw-r11-menubar { flex: 1 1 100% !important; justify-content: flex-start !important; margin: 2px 0 0 !important; }
}

/* Do not let an already crowded desktop header squeeze multi-row menus into
   the fixed-height toolbar or cover the drawing tabs. */
@media (max-width: 1050px) {
  #fw-r11-header,
  .topbar.fw-r11-designer {
    height: auto !important;
    min-height: 68px !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    align-content: center !important;
  }
  .topbar.fw-r11-designer .topbar-logo-wrap,
  #fw-r11-header .fw-r11-brand { order: 1 !important; }
  .topbar.fw-r11-designer .fw-r11-status { order: 2 !important; margin-left: auto !important; }
  .topbar.fw-r11-designer .fw-r11-menubar,
  #fw-r11-header .fw-r11-menubar {
    order: 3 !important;
    flex: 1 1 100% !important;
    justify-content: flex-start !important;
    margin: 3px 0 0 !important;
  }
}
