/* Web display assets use the existing Claire frame; original PNGs are retained. */
:root, body.corporate-ui {
  --header-logo-height: 2.25rem;
  --corp-topbar-height: 3.5rem;
}
.product-logo {
  --product-crop-width: 2128;
  --product-crop-height: 480;
  --product-logo-height: var(--header-logo-height, 3rem);
  position: relative;
  display: block;
  flex-shrink: 0;
  width: calc(var(--product-crop-width) / var(--product-crop-height) * var(--product-logo-height));
  height: var(--product-logo-height);
  overflow: hidden;
  background-color: transparent;
  line-height: 0;
}
.product-logo > .product-logo__image {
  position: absolute;
  display: block;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: fill;
}

body.corporate-ui .app-shell .app-topbar {
  height: var(--corp-topbar-height);
  min-height: var(--corp-topbar-height);
  max-height: var(--corp-topbar-height);
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 0.75rem !important;
  padding: 0.25rem 1rem !important;
  background: #fff;
}
body.corporate-ui .app-shell .app-topbar .app-topbar-left {
  width: auto;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  gap: 0.75rem;
  justify-content: flex-start;
}
body.corporate-ui .app-shell .app-topbar .app-topbar-brand {
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  min-width: 0;
}
body.corporate-ui .app-shell .app-topbar .app-topbar-brand .app-brand-logo {
  width: calc(var(--header-logo-height) * 646 / 224) !important;
  max-width: none !important;
  height: var(--header-logo-height) !important;
  max-height: none !important;
  filter: none !important;
}
body.corporate-ui .app-shell .app-topbar .app-topbar-wordmark {
  width: auto;
  max-width: none;
  height: auto !important;
  background: transparent;
  gap: 0;
}
body.corporate-ui .app-topbar .profile-menu-trigger { max-width: min(20vw, 18rem); }
.auth-brand > .product-logo { --product-logo-height: 3rem; }
.login-product-brand {
  display: flex;
  justify-content: center;
  width: 100%;
  margin: 0 auto 1.5rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  background: transparent;
  line-height: 0;
}
.login-product-brand > .product-logo {
  --product-logo-height: clamp(2.5rem, 6vw, 3rem);
}

/* A form preview has less room than the live header. Fit both complete logos. */
body.corporate-ui .client-network-overlay .network-logo-preview,
.corporate-ui .network-logo-preview {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  height: auto;
  min-height: 4.5rem;
}
.corporate-ui .network-logo-preview-brand { min-width: 0; }
.corporate-ui .network-logo-preview-brand canvas {
  max-width: 100%;
  object-fit: contain;
}
.corporate-ui .network-logo-preview > .product-logo {
  --product-logo-height: 1.5rem;
  justify-self: center;
}
body.corporate-ui .client-network-overlay .network-logo-preview[data-logo-preview=mobile],
.corporate-ui .network-logo-preview[data-logo-preview=mobile] {
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: 'menu client user' 'product product product';
  grid-template-rows: auto auto;
  min-height: 7rem;
}
.corporate-ui .network-logo-preview[data-logo-preview=mobile] .network-logo-preview-menu { grid-area: menu; }
.corporate-ui .network-logo-preview[data-logo-preview=mobile] .network-logo-preview-brand { grid-area: client; justify-self: center; }
.corporate-ui .network-logo-preview[data-logo-preview=mobile] .network-logo-preview-profile { grid-area: user; }
.corporate-ui .network-logo-preview[data-logo-preview=mobile] > .product-logo { grid-area: product; }

@media (min-width: 681px) and (max-width: 1024px) {
  body.corporate-ui .app-topbar :is(.app-menu-button, .profile-menu-trigger, .ad-notification-trigger) {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    justify-content: center;
  }
  body.corporate-ui .app-topbar .app-menu-icon { display: block; width: 20px; height: 20px; }
  body.corporate-ui .app-topbar :is(.app-menu-label, .profile-menu-copy, .profile-menu-caret) { display: none; }
}

/* Keep the two equally sized logos side by side on phones; controls get a row. */
@media (max-width: 680px) {
  :root, body.corporate-ui {
    --header-logo-height: min(2rem, calc((100vw - 2.25rem) / 7.35));
    --corp-topbar-height: 6.75rem;
  }
  body.corporate-ui .app-shell .app-topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 2.75rem 2.75rem;
    grid-template-areas: 'client product' 'menu actions';
    gap: 0.375rem 0.75rem !important;
    padding: 0.375rem 0.75rem !important;
  }
  body.corporate-ui .app-shell .app-topbar .app-topbar-left { display: contents !important; }
  body.corporate-ui .app-shell .app-topbar .app-topbar-brand { grid-area: client; padding: 0; }
  body.corporate-ui .app-shell .app-topbar .app-topbar-wordmark { grid-area: product; justify-self: end; flex-direction: row; }
  body.corporate-ui .app-topbar .app-menu-button { grid-area: menu; justify-self: start; }
  body.corporate-ui .app-topbar .app-topbar-actions { grid-area: actions; gap: 0.5rem !important; }
  body.corporate-ui .app-topbar :is(.app-menu-button, .profile-menu-trigger, .ad-notification-trigger) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
  }
  body.corporate-ui .app-topbar .app-menu-icon { display: block; width: 20px; height: 20px; }
  body.corporate-ui .app-topbar :is(.app-menu-label, .profile-menu-copy, .profile-menu-caret) { display: none; }
  body.corporate-ui .app-topbar .profile-menu-panel { max-height: calc(100dvh - var(--corp-topbar-height) - 1rem); }
}

/* Client artwork uses its own aspect ratio and selected height. The available
   grid cell bounds width; height follows that width without distortion. */
body.corporate-ui .app-shell .app-topbar .app-network-brand {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  padding: 2px;
}
body.corporate-ui .app-shell .app-topbar .app-network-brand .app-brand-logo {
  width: calc(var(--network-logo-height, 32px) * var(--network-logo-ratio, 2.883929)) !important;
  max-width: min(240px, 100%) !important;
  height: auto !important;
  max-height: none !important;
  aspect-ratio: var(--network-logo-ratio, 2.883929);
}
.corporate-ui .network-logo-preview { overflow: hidden; }
.corporate-ui .network-logo-preview-brand canvas { display: block; }
.corporate-ui .network-logo-size {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr);
  gap: 8px 10px;
}
.corporate-ui .network-logo-size input[type="range"] { min-width: 0; }
.corporate-ui .network-logo-size output {
  grid-column: 1 / -1;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}
@media (max-width: 640px) {
  .corporate-ui .network-logo-size { grid-template-columns: minmax(0, 1fr); }
  .corporate-ui .network-logo-size input[type="range"] { grid-column: 1 / -1; }
}

/* Scale the whole simulated header, rather than fixing the canvas height.
   Its dimension label reports actual CSS pixels at the stated viewport. */
body.corporate-ui .network-logo-preview,
body.corporate-ui .client-network-overlay .network-logo-preview {
  display: block;
  position: relative;
  box-sizing: border-box;
  min-height: 64px;
  padding: 0;
}
.network-logo-preview-viewport {
  position: absolute;
  top: 50%; left: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 4px 16px;
  box-sizing: border-box;
  transform-origin: left center;
}
.network-logo-preview-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.network-logo-preview-profile { justify-self: end; }
.network-logo-preview-viewport > .product-logo { --product-logo-height: 36px; }
body.corporate-ui .network-logo-preview[data-logo-preview=mobile] { min-height: 108px; }
.network-logo-preview[data-logo-preview=mobile] .network-logo-preview-viewport {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 44px 44px;
  grid-template-areas: 'client product' 'menu user';
  height: 108px; padding: 6px 12px; gap: 6px 12px;
}
.network-logo-preview[data-logo-preview=mobile] .network-logo-preview-left { display: contents; }
.network-logo-preview[data-logo-preview=mobile] .network-logo-preview-menu { grid-area: menu; }
.network-logo-preview[data-logo-preview=mobile] .network-logo-preview-profile { grid-area: user; }
.network-logo-preview[data-logo-preview=mobile] .network-logo-preview-brand { grid-area: client; justify-self: start; }
.network-logo-preview[data-logo-preview=mobile] .network-logo-preview-viewport > .product-logo { grid-area: product; --product-logo-height: 32px; }

/* Wide client artwork gets a full phone row so its selected size can grow.
   Product identity and touch controls share the second row. */
@media (max-width: 680px) {
  body.corporate-ui .app-shell .app-topbar:has(.app-network-brand) {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    grid-template-areas: 'client client client' 'menu product actions';
  }
  body.corporate-ui .app-shell .app-topbar .app-network-brand { justify-self: center; }
  body.corporate-ui .app-shell .app-topbar:has(.app-network-brand) .app-topbar-wordmark {
    justify-self: center;
  }
  body.corporate-ui .app-topbar:has(.app-network-brand) .app-topbar-wordmark .product-logo {
    --product-logo-height: 24px;
  }
}
.network-logo-preview[data-logo-preview=mobile].network-logo-preview--custom .network-logo-preview-viewport {
  grid-template-columns: 44px minmax(0, 1fr) auto;
  grid-template-areas: 'client client client' 'menu product user';
}
.corporate-ui .network-logo-preview[data-logo-preview=mobile].network-logo-preview--custom .network-logo-preview-brand { justify-self: center; }
.network-logo-preview[data-logo-preview=mobile].network-logo-preview--custom .network-logo-preview-viewport > .product-logo { --product-logo-height: 24px; }
