/* Home search bar refinement based on approved reference */
.home-main-search {
  min-height: 68px;
  grid-template-columns: 190px minmax(0, 1fr) 62px;
  grid-template-areas: "modes input submit";
  direction: ltr;
  overflow: hidden;
  border: 8px solid #f5f6f8;
  border-radius: 36px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.055);
}

.home-search-modes {
  grid-area: modes;
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  direction: ltr;
  border-left: 0;
  border-right: 1px solid #e4e7eb;
  background: #ffffff;
}

.home-search-mode {
  min-width: 0;
  border: 0;
  background: #ffffff;
  color: #a0a6ad;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
}

.home-search-mode.is-active {
  margin: 7px;
  border-radius: 20px;
  background: #e83f73;
  color: #ffffff;
}

.home-main-search input {
  grid-area: input;
  position: relative;
  z-index: 2;
  width: 100%;
  min-width: 0;
  padding: 0 26px;
  border: 0;
  outline: 0;
  background: #ffffff;
  color: #343a42;
  font: inherit;
  font-size: 0.96rem;
  text-align: right;
  direction: rtl;
  cursor: text;
  pointer-events: auto;
  user-select: text;
}

.home-main-search input::placeholder {
  color: #858e99;
  opacity: 1;
  text-align: right;
  direction: rtl;
}

.home-main-search input:focus {
  background: #ffffff;
  box-shadow: none;
}

.home-search-submit {
  grid-area: submit;
  width: 48px;
  height: 48px;
  align-self: center;
  justify-self: center;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #f6f7f9;
  color: #e83f73;
  cursor: pointer;
}

.home-search-submit svg {
  width: 25px;
  height: 25px;
  fill: currentColor;
}

@media (max-width: 700px) {
  .home-main-search {
    min-height: 58px;
    grid-template-columns: 96px minmax(0, 1fr) 50px;
    grid-template-areas: "modes input submit";
    border-width: 6px;
    border-radius: 30px;
  }

  .home-search-modes {
    grid-template-columns: 1fr;
  }

  .home-search-mode.is-disabled {
    display: none;
  }

  .home-search-mode.is-active {
    margin: 5px;
  }

  .home-main-search input {
    padding-inline: 12px;
    font-size: 0.78rem;
  }

  .home-search-submit {
    width: 42px;
    height: 42px;
  }

  .home-search-submit svg {
    width: 22px;
    height: 22px;
  }
}


/* Mobile corrections */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 700px) {
  .home-topbar {
    min-height: auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "brand nav";
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
  }

  .home-topbar-brand {
    grid-area: brand;
  }

  .home-topbar-nav {
    grid-area: nav;
    width: 100%;
    min-width: 0;
    display: flex;
    flex-wrap: nowrap;
    gap: 14px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    padding: 2px 0;
  }

  .home-topbar-nav::-webkit-scrollbar {
    display: none;
  }

  .home-topbar-item {
    flex: 0 0 auto;
    font-size: 0.67rem;
  }

  .home-topbar-badge {
    min-width: 24px;
    min-height: 22px;
    padding: 2px 7px;
  }

  .home-hero {
    width: calc(100% - 16px);
    margin-top: 36px;
  }

  .home-brand-emblem {
    width: 84px;
    height: 84px;
    border-radius: 23px;
  }

  .home-brand-emblem span {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    font-size: 1.75rem;
  }

  .home-hero h1 {
    margin-top: 14px;
    font-size: 1.05rem;
  }

  .home-hero > p {
    margin-bottom: 14px;
    font-size: 0.76rem;
  }

  .home-main-search {
    width: 100%;
    min-height: 56px;
    grid-template-columns: 112px minmax(0, 1fr) 48px;
    grid-template-areas: "modes input submit";
    border-width: 5px;
    border-radius: 28px;
  }

  .home-search-modes {
    grid-template-columns: 1fr 1fr;
    border-right: 1px solid #e4e7eb;
  }

  .home-search-mode {
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 0 4px;
    font-size: 0.61rem;
  }

  .home-search-mode.is-active {
    margin: 5px 3px;
    border-radius: 16px;
  }

  .home-main-search input {
    min-height: 46px;
    padding: 0 10px;
    font-size: 0.74rem;
    line-height: 1.2;
    text-align: right;
    white-space: nowrap;
  }

  .home-main-search input::placeholder {
    font-size: 0.72rem;
    text-align: right;
  }

  .home-search-submit {
    width: 40px;
    height: 40px;
  }

  .home-search-submit svg {
    width: 21px;
    height: 21px;
  }

  .home-category-grid {
    margin-top: 32px;
    padding: 0 10px 8px;
    gap: 10px;
  }

  .home-category-card {
    flex-basis: 72px;
  }

  .home-category-icon {
    width: 68px;
    height: 68px;
  }

  .home-category-icon svg {
    width: 40px;
    height: 40px;
  }

  .home-category-card strong {
    font-size: 0.68rem;
  }

  .home-category-count {
    right: calc(50% - 36px);
    min-width: 32px;
    min-height: 20px;
    font-size: 0.56rem;
  }

  .home-footer {
    padding: 24px 12px 16px;
  }

  .home-footer nav span {
    padding-inline: 7px;
    font-size: 0.62rem;
  }

  .home-accessibility {
    left: 12px;
    bottom: 18px;
    width: 46px;
    height: 46px;
  }
}

@media (max-width: 390px) {
  .home-main-search {
    grid-template-columns: 104px minmax(0, 1fr) 46px;
  }

  .home-search-mode {
    font-size: 0.58rem;
  }

  .home-main-search input,
  .home-main-search input::placeholder {
    font-size: 0.68rem;
  }
}


/* Mobile home polish after device review */
@media (max-width: 700px) {
  .home-topbar {
    grid-template-columns: 42px minmax(0, 1fr);
    grid-template-areas: "brand nav";
    direction: rtl;
  }

  .home-topbar-brand {
    justify-self: end;
  }

  .home-topbar-nav {
    direction: rtl;
    justify-content: flex-start;
    overflow: hidden;
    gap: 10px;
  }

  .home-topbar-item:nth-child(3),
  .home-topbar-item:nth-child(4) {
    display: none;
  }

  .home-topbar-item {
    font-size: 0.69rem;
  }

  .home-category-grid {
    direction: rtl;
    scroll-padding-inline: 10px;
    padding-inline: 10px;
  }

  .home-footer {
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
  }

  .home-accessibility {
    bottom: calc(92px + env(safe-area-inset-bottom));
  }
}
