/*
 * 123eetstoel v2.5.1 mobile header correction.
 * Design read: trust-first, fast-purchase furniture commerce.
 * This final layer deliberately overrides older responsive header rules.
 */

@media (max-width: 768px) {
  .es-header {
    background: color-mix(in srgb, var(--es-canvas) 98%, transparent);
  }

  .es-header__main {
    position: relative;
    display: grid;
    min-height: 0;
    padding-top: 11px;
    padding-bottom: 9px;
    align-items: center;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    grid-template-areas:
      "menu logo spacer"
      "actions actions actions";
    column-gap: 8px;
    row-gap: 9px;
  }

  /* Keep the logo optically centered, independent of the menu width. */
  .es-header__main::after {
    display: block;
    width: 48px;
    height: 48px;
    grid-area: spacer;
    content: "";
  }

  .es-header__mobile-start {
    display: flex !important;
    width: 48px;
    align-items: center;
    justify-content: flex-start;
    grid-area: menu;
    justify-self: start;
  }

  .es-mobile-toggle {
    display: inline-grid !important;
    width: 46px;
    min-width: 46px;
    height: 46px;
    min-height: 46px;
    padding: 0;
    place-items: center;
    border-color: color-mix(in srgb, var(--es-ink) 18%, var(--es-border));
    background: var(--es-canvas);
    box-shadow: 0 7px 22px rgba(31, 35, 36, 0.055);
  }

  .es-mobile-toggle__glyph {
    width: 20px;
    gap: 5px;
  }

  .es-mobile-toggle__glyph i {
    height: 2px;
  }

  .es-logo {
    display: flex;
    width: min(100%, 174px) !important;
    max-width: 174px;
    min-width: 0;
    overflow: visible;
    align-items: center;
    justify-content: center;
    grid-area: logo;
    justify-self: center !important;
  }

  .es-logo .custom-logo-link {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
  }

  .es-logo__image,
  .es-logo .custom-logo {
    display: block;
    width: 100% !important;
    max-width: 174px !important;
    height: 44px !important;
    max-height: 44px !important;
    object-fit: contain;
    object-position: center;
    transform: scale(var(--es-logo-visual-scale, 1));
    transform-origin: center;
  }

  /* All four commerce shortcuts stay visible in a stable second header row. */
  .es-mobile-header-actions {
    display: grid !important;
    width: 100%;
    min-width: 0;
    padding-top: 8px;
    border-top: 1px solid var(--es-border);
    align-items: stretch;
    grid-area: actions;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 5px !important;
    justify-self: stretch;
  }

  .es-mobile-header-action {
    position: relative;
    display: flex !important;
    width: auto !important;
    min-width: 0;
    height: 42px !important;
    padding: 5px 3px !important;
    align-items: center;
    justify-content: center;
    gap: 5px !important;
    border: 0;
    border-radius: 10px;
    background: transparent;
    box-shadow: none;
    color: var(--es-ink);
    font-size: 0.59rem;
    font-weight: 750;
    line-height: 1;
    text-decoration: none;
    transition: background-color 180ms ease, color 180ms ease, transform 160ms ease;
  }

  .es-mobile-header-action:hover,
  .es-mobile-header-action:focus-visible {
    background: var(--es-surface);
    color: var(--es-accent);
  }

  .es-mobile-header-action:active {
    transform: scale(0.98);
  }

  .es-mobile-header-action .es-icon {
    display: block !important;
    width: 20px !important;
    height: 20px !important;
    flex: 0 0 20px;
    overflow: visible;
    color: currentColor;
    stroke-width: 1.85;
  }

  .es-mobile-header-action > span {
    display: block !important;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    color: currentColor;
    font-size: inherit !important;
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .es-mobile-header-action .es-count {
    position: absolute;
    top: 0;
    right: 3px;
    min-width: 16px;
    height: 16px;
    padding-inline: 3px;
    border: 2px solid var(--es-canvas);
    font-size: 0.53rem;
  }
}

@media (max-width: 420px) {
  .es-header__main {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    column-gap: 6px;
  }

  .es-header__main::after,
  .es-header__mobile-start {
    width: 44px;
  }

  .es-header__main::after {
    height: 44px;
  }

  .es-mobile-toggle {
    width: 43px;
    min-width: 43px;
    height: 43px;
    min-height: 43px;
  }

  .es-logo {
    width: min(100%, 158px) !important;
    max-width: 158px;
  }

  .es-logo__image,
  .es-logo .custom-logo {
    max-width: 158px !important;
    height: 40px !important;
    max-height: 40px !important;
  }

  .es-mobile-header-action {
    gap: 4px !important;
    font-size: 0.53rem;
  }

  .es-mobile-header-action .es-icon {
    width: 19px !important;
    height: 19px !important;
    flex-basis: 19px;
  }
}

@media (max-width: 350px) {
  .es-logo {
    max-width: 142px;
  }

  .es-logo__image,
  .es-logo .custom-logo {
    max-width: 142px !important;
  }

  .es-mobile-header-action {
    flex-direction: column;
    gap: 2px !important;
    font-size: 0.49rem;
  }
}
