:root {
  --nyys-mobile-nav-height: 64px;
}

.nyys-mobile-nav,
.nyys-mobile-categories {
  display: none;
}

@media (max-width: 720px) {
  body {
    padding-bottom: calc(var(--nyys-mobile-nav-height) + env(safe-area-inset-bottom, 0px));
  }

  body.nyys-mobile-categories-open {
    overflow: hidden;
  }

  .nyys-mobile-nav {
    position: fixed;
    z-index: 10010;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-height: calc(var(--nyys-mobile-nav-height) + env(safe-area-inset-bottom, 0px));
    padding: 0 0 env(safe-area-inset-bottom, 0px);
    border-top: 1px solid #dedede;
    color: #6a6a6a;
    background: #fff;
  }

  body.nyys-cart-drawer-open .nyys-mobile-nav,
  body.nyys-mobile-categories-open .nyys-mobile-nav {
    z-index: 10050;
  }

  .easystore-chat-button {
    bottom: calc(var(--nyys-mobile-nav-height, 64px) + 12px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 10000 !important;
  }

  .easystore-widget-window {
    bottom: calc(var(--nyys-mobile-nav-height, 64px) + 84px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .nyys-mobile-nav__item {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 4.4rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    margin: 0;
    border: 0;
    padding: 0.5rem 0.2rem 0.4rem;
    color: inherit;
    background: transparent;
    font: inherit;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(17, 17, 17, 0.08);
  }

  .nyys-mobile-nav__item.is-active,
  .nyys-mobile-nav__item[aria-expanded='true'] {
    color: #111;
    font-weight: 700;
  }

  .nyys-mobile-nav__item:focus-visible,
  .nyys-mobile-categories a:focus-visible,
  .nyys-mobile-categories button:focus-visible {
    outline: 2px solid #111;
    outline-offset: -3px;
  }

  .nyys-mobile-nav__icon {
    position: relative;
    display: grid;
    width: 2.2rem;
    height: 2.2rem;
    place-items: center;
  }

  .nyys-mobile-nav__icon .icon {
    width: 2.2rem;
    height: 2.2rem;
  }

  .nyys-mobile-nav__count {
    position: absolute;
    top: -0.6rem;
    right: -0.9rem;
    display: grid;
    min-width: 1.7rem;
    height: 1.7rem;
    place-items: center;
    border-radius: 999px;
    padding: 0 0.4rem;
    color: #fff;
    background: #111;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1;
  }

  .nyys-mobile-nav__count.is-empty {
    display: none;
  }

  .nyys-mobile-categories:not([hidden]) {
    position: fixed;
    z-index: 10020;
    top: 0;
    right: 0;
    bottom: calc(var(--nyys-mobile-nav-height, 64px) + env(safe-area-inset-bottom, 0px));
    left: 0;
    display: flex;
    align-items: flex-end;
  }

  .nyys-mobile-categories__backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.48);
  }

  .nyys-mobile-categories__sheet {
    position: relative;
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - var(--nyys-mobile-nav-height, 64px) - 4.8rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 1.8rem 1.8rem 0 0;
    padding: 2rem 1.6rem 1.6rem;
    color: #171717;
    background: #fff;
    box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.2);
    -webkit-overflow-scrolling: touch;
    animation: nyys-mobile-category-enter 180ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .nyys-mobile-categories__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.6rem;
    margin-bottom: 1.8rem;
  }

  .nyys-mobile-categories__header h2 {
    margin: 0;
    color: #111;
    font-size: 2.2rem;
    line-height: 1.25;
    letter-spacing: -0.02em;
  }

  .nyys-mobile-categories__header p {
    margin: 0.4rem 0 0;
    color: #5f5f5f;
    font-size: 1.3rem;
    line-height: 1.5;
    letter-spacing: 0;
  }

  .nyys-mobile-categories__close {
    display: grid;
    width: 4.4rem;
    height: 4.4rem;
    flex: 0 0 4.4rem;
    place-items: center;
    border: 0;
    border-radius: 50%;
    padding: 1.3rem;
    color: #111;
    background: #f2f2f2;
    cursor: pointer;
  }

  .nyys-mobile-categories__close .icon {
    width: 100%;
    height: 100%;
  }

  .nyys-mobile-categories__list {
    display: grid;
    min-height: 0;
    flex: 1;
    align-content: start;
    grid-auto-rows: minmax(5.2rem, auto);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .nyys-mobile-categories__list li {
    min-width: 0;
  }

  .nyys-mobile-categories__list a {
    display: flex;
    min-height: 5.2rem;
    align-items: center;
    justify-content: center;
    border: 1px solid #dedede;
    border-radius: 1.2rem;
    padding: 0.8rem 1rem;
    color: #171717;
    background: #fff;
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: 0;
    text-align: center;
    text-decoration: none;
  }

  .nyys-mobile-categories[aria-busy='true'] .nyys-mobile-categories__list {
    pointer-events: none;
  }

  .nyys-mobile-categories__sheet.is-navigating .nyys-mobile-categories__list a:not(.is-navigating) {
    opacity: 0.46;
  }

  .nyys-mobile-categories__list a.is-navigating {
    gap: 0.8rem;
    border-color: #111;
    color: #fff;
    background: #111;
  }

  .nyys-mobile-categories__list a.is-navigating::after {
    width: 1.4rem;
    height: 1.4rem;
    flex: 0 0 1.4rem;
    border: 0.2rem solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    content: '';
    animation: nyys-category-link-busy 650ms linear infinite;
  }

  .nyys-mobile-categories__all {
    grid-column: 1 / -1;
  }

  .nyys-mobile-categories__all a {
    color: #fff;
    border-color: #171717;
    background: #171717;
  }

  @keyframes nyys-mobile-category-enter {
    from { transform: translateY(2.4rem); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }

  @keyframes nyys-category-link-busy {
    to { transform: rotate(360deg); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .nyys-mobile-categories__list a.is-navigating::after {
    animation-duration: 1.4s;
  }
}

@media (max-width: 340px) {
  .nyys-mobile-nav__item {
    font-size: 1rem;
  }

  .nyys-mobile-categories__list {
    grid-template-columns: 1fr;
  }

  .nyys-mobile-categories__all {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nyys-mobile-categories__sheet {
    animation-duration: 0.01ms !important;
  }
}
