/*
 * Brand lockup sizing.
 *
 * Loaded last (after style.css / responsive.css / admin-style.css) so this is
 * the single place that decides how big the logo is on each surface. The artwork
 * is a stacked emblem + wordmark (aspect ratio ~1.66), so displayed height is
 * what decides whether the wordmark reads: at 44px the letters are roughly 19px
 * tall, about the smallest that still reads at a glance.
 *
 * Every rule sets a height plus `width:auto` and never both dimensions, so the
 * logo can never be squashed into a box it does not fit.
 */

/* ---------- default sizes (overridden per surface below) ---------- */
.brand-logo img {
  width: auto;
  max-width: 100%;
  display: block;
  object-fit: contain;
}

/* The wordmark needs about 42px before its letters read; the `sm` size is for
   small placements (footer, dense admin bars) where the mark alone is used. */
.brand-logo--sm img {
  height: 30px;
}

.brand-logo--md img {
  height: 44px;
}

.brand-logo--lg img {
  height: 64px;
}

/* ---------- customer site header ---------- */
.header-top {
  /* was a fixed 60px, which clipped a 44px logo plus its padding */
  height: auto;
  min-height: 70px;
  align-items: center;
}

.header-top .logo,
.header-top .logo .brand-logo {
  display: inline-flex;
  align-items: center;
  min-height: 0;
  height: auto;
}

.header-top .logo img,
.logo .brand-logo img {
  /* The wordmark's lettering is only about 42% of the artwork's height, so it
     needs ~48px before it reads at a glance. Below ~44px the white letters
     smear into a dark blob on a coloured bar, which is what made the old logo
     look wrong in the header. No drop-shadow here either: the artwork already
     has its own shading, and a filter on top of it only muddies it at this
     size. */
  height: 52px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

/* ---------- auth screens (login / register / admin login) ---------- */
.hx-auth-logo {
  display: block;
  width: auto;
  height: 72px;
  max-width: 200px;
  max-height: none;
  margin: 0 auto 16px;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.28));
}

/* 404 + transaction-password use a logo inside a narrow card */
.log-logo .logo-login {
  display: block;
  width: auto;
  height: 64px;
  max-width: 200px;
  margin: 0 auto;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}

/* ---------- admin panel header + drawer ---------- */
.hx-site-logo {
  display: inline-flex;
  align-items: center;
  height: 100%;
}

.hx-site-logo img,
.drawer-header img {
  height: 40px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
}

/* the drawer is a tall panel, so its logo can be larger than the top bar's */
.drawer-header img {
  height: 48px;
}

/* ---------- small screens ---------- */
@media (max-width: 991px) {
  .header-top {
    min-height: 60px;
  }

  .header-top .logo img,
  .logo .brand-logo img {
    height: 46px;
  }

  .hx-auth-logo {
    height: 60px;
    max-width: 170px;
  }

  .log-logo .logo-login {
    height: 54px;
    max-width: 170px;
  }

  .hx-site-logo img {
    height: 30px;
  }
}

@media (max-width: 575px) {
  .header-top .logo img,
  .logo .brand-logo img {
    /* 42px keeps the letters around 18px - the floor for legibility. Going
       smaller is what turned the wordmark into an unreadable smudge. */
    height: 42px;
  }
}

/*
 * A logo published from the Mother Panel is applied as an inline style on the
 * img (see `applyLogo()` in utils/branding.ts), and inline styles already beat
 * everything here - so no rule is needed for it, and adding one (a stray
 * `height: inherit` used to live here) actually broke these sizes by inheriting
 * the parent's `auto` height instead of the value set above.
 */

/*
 * The auth / 404 screens wrap their card in `.wrapper`, and responsive.css makes
 * that a fixed 1100px box with horizontal scrolling below 768px. On a phone that
 * pushed the card - and its logo - off the left edge, so the page looked broken
 * no matter what the logo did. Scoped to `.login` because that is what those
 * screens render; the main layout keeps its own wrapper rules.
 */
@media (max-width: 768px) {
  .login .wrapper {
    width: 100%;
    overflow-x: hidden;
  }
}

