/* Sticky header (every screen size) + mobile navigation (<= 767px). */

/* The top bar stays visible while the page scrolls. */
#top-header {
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* Preserve the home-page H1 for document semantics without letting it alter
   the shared logo/header geometry at any viewport size. */
#top-header #logo .header-home-title {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* "overflow-x: hidden" on html/body (see responsive.css) turns body into a scroll
   container and silently disables position: sticky. "clip" hides horizontal
   overflow the same way without creating a scroll container. */
@supports (overflow-x: clip) {
  html,
  body {
    overflow-x: clip !important;
  }
}

/* Hamburger button and panel exist only on phones. */
#top-header .mobile-menu-toggle,
#top-header .mobile-menu {
  display: none;
}

@media (max-width: 767px) {
  /* Canonical mobile header layout. This file loads after both theme.css and
     the home-only theme_2.css, so every page gets identical geometry. */
  #top-header > .menu-store:first-child {
    margin-right: 0 !important;
    margin-left: 0 !important;
  }
  #top-header > .menu-store:first-child > .container {
    box-sizing: border-box;
    width: 100%;
    padding-right: 10px;
    padding-left: 10px;
  }
  #top-header .menu-store:first-child > .container > .head {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    width: 100%;
    padding-right: 0;
    padding-left: 0;
  }
  #top-header #logo {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    min-width: 0;
    padding: 10px !important;
    background: #000;
  }
  #top-header #logo > a {
    display: block;
    flex: 0 0 81px;
    width: 81px;
    height: 23px;
    line-height: 0;
  }
  #top-header #logo > a img {
    display: block;
    width: 81px !important;
    height: 23px;
  }
  #top-header #logo .adrress {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 4px 0 4px 8px !important;
  }
  #top-header .th-text {
    padding: 6px 0;
  }
  #top-header .th-text .th-item {
    display: block;
    width: 100%;
    line-height: 32px;
  }
  #top-header #search_form_simple {
    width: 100%;
  }
  #top-header #search_form_simple .keyword_simple {
    box-sizing: border-box;
  }
  #top-header .order_mobile {
    flex: 0 0 auto;
  }

  #top-header .mobile-menu-toggle {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    align-self: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    margin: 0 2px 0 4px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  #top-header .mobile-menu-toggle:focus {
    outline: 0;
  }
  #top-header .mobile-menu-toggle:focus-visible {
    outline: 2px solid #fed700;
    outline-offset: 2px;
  }
  #top-header .mobile-menu-toggle__bar {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: #fff;
    transition: transform .2s ease, opacity .2s ease;
  }
  #top-header .mobile-menu-toggle[aria-expanded="true"] .mobile-menu-toggle__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  #top-header .mobile-menu-toggle[aria-expanded="true"] .mobile-menu-toggle__bar:nth-child(2) {
    opacity: 0;
  }
  #top-header .mobile-menu-toggle[aria-expanded="true"] .mobile-menu-toggle__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* Dropdown panel, anchored under the black top bar (.menu-store is position: relative). */
  #top-header .mobile-menu {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1001;
    max-height: calc(100vh - 68px);
    max-height: calc(100dvh - 68px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #111;
    border-top: 1px solid #333;
    box-shadow: 0 10px 18px rgba(0, 0, 0, .35);
  }
  #top-header .mobile-menu[hidden] {
    display: none;
  }
  .mobile-menu-open .totop {
    display: none !important;
  }
  #top-header .mobile-menu__list,
  #top-header .mobile-menu__sub {
    margin: 0;
    padding: 0;
    list-style: none;
  }
  #top-header .mobile-menu__item {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    margin: 0;
    padding: 0;
    border-bottom: 1px solid #2a2a2a;
  }
  #top-header .mobile-menu__link {
    display: block;
    flex: 1 1 0;
    min-width: 0;
    padding: 14px 16px;
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    line-height: 20px;
    text-decoration: none;
  }
  #top-header .mobile-menu__icon {
    display: inline-block;
    width: 20px;
    margin-right: 10px;
    color: #fed700;
    font-size: 16px;
    text-align: center;
  }
  #top-header .mobile-menu__icon.fa-mobile { font-size: 20px; }
  #top-header .mobile-menu__link:hover,
  #top-header .mobile-menu__link:focus {
    background: #1c1c1c;
    color: #fed700;
    text-decoration: none;
  }
  #top-header .mobile-menu__expand {
    position: relative;
    flex: 0 0 52px;
    padding: 0;
    border: 0;
    border-left: 1px solid #2a2a2a;
    background: transparent;
    color: #fff;
    cursor: pointer;
  }
  #top-header .mobile-menu__expand::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translate(-50%, -70%) rotate(45deg);
    transition: transform .2s ease;
  }
  #top-header .mobile-menu__expand[aria-expanded="true"] {
    color: #fed700;
  }
  #top-header .mobile-menu__expand[aria-expanded="true"]::before {
    transform: translate(-50%, -30%) rotate(-135deg);
  }
  #top-header .mobile-menu__sub {
    flex: 0 0 100%;
    background: #0a0a0a;
  }
  #top-header .mobile-menu__sub[hidden] {
    display: none;
  }
  #top-header .mobile-menu__sub li {
    margin: 0;
    padding: 0;
  }
  #top-header .mobile-menu__sub a {
    display: block;
    padding: 12px 16px 12px 32px;
    border-top: 1px solid #1f1f1f;
    color: #d8d8d8;
    font-size: 14px;
    line-height: 20px;
    text-decoration: none;
  }
  #top-header .mobile-menu__sub a:hover,
  #top-header .mobile-menu__sub a:focus {
    color: #fed700;
    text-decoration: none;
  }
}
