/*
 * 모바일 화면을 메뉴별로 순차 개편할 수 있도록 제공하는 공통 앱 셸입니다.
 * `mobile-shell-enabled`를 body에 선언한 화면에만 적용되므로 아직 개편하지 않은 화면과 PC UI는 유지됩니다.
 */
.common-brand-mobile-shell {
  display: none;
}

@media (max-width: 1023px) {
  .mobile-shell-enabled {
    background: #fff;
  }

  .mobile-shell-enabled #app-shell {
    min-height: 100dvh;
    background: #fff;
  }

  /* 상단 로고는 문서 흐름에 두어 스크롤하면 자연스럽게 화면 밖으로 이동합니다. */
  .mobile-shell-enabled #commonSiteHeader {
    /* 문서와 함께 스크롤하면서 프로필 드롭다운은 고정된 본문 제목 위에 표시한다. */
    position: relative;
    padding-top: env(safe-area-inset-top);
    border-radius: 0;
    box-shadow: none;
  }

  .mobile-shell-enabled .common-brand-default,
  .common-brand-mobile-shell {
    display: none;
  }

  .mobile-shell-enabled .common-brand-mobile-shell {
    display: inline;
  }

  /* 앱 셸에서는 하단 전체메뉴로 전용 페이지에 이동하므로 기존 햄버거 버튼을 중복 노출하지 않습니다. */
  .mobile-shell-enabled #commonMobileMenuButton {
    display: none;
  }

  .mobile-shell-enabled #main-content {
    overflow: visible;
    padding-bottom: calc(6rem + env(safe-area-inset-bottom));
  }

  /* 서브메뉴는 로고 아래에서 시작하고, 로고가 사라진 뒤에는 뷰포트 최상단에 고정됩니다. */
  .mobile-submenu {
    position: sticky;
    top: 0;
    z-index: 30;
    border-bottom: 1px solid #e7e5e4;
    background: rgba(255, 255, 255, 0.96);
    padding: 0.5rem 1rem;
    backdrop-filter: blur(12px);
  }

  /* 아직 앱 셸을 적용하지 않은 화면의 기존 드로어 스타일을 함께 유지합니다. */
  .mobile-shell-enabled #commonMobileMenu {
    top: 0;
    width: min(88vw, 24rem);
    height: 100dvh;
    padding-top: calc(1rem + env(safe-area-inset-top));
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }
}

.mobile-bottom-navigation {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 45;
  border-top: 1px solid #e7e5e4;
  background: rgba(255, 255, 255, 0.98);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -8px 24px rgba(28, 25, 23, 0.08);
  backdrop-filter: blur(12px);
}

.mobile-bottom-navigation__items {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  min-height: 4.25rem;
}

.mobile-bottom-navigation__item {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 4.25rem;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.2rem;
  border: 0;
  color: #57534e;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1rem;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.mobile-bottom-navigation__item::before {
  position: absolute;
  top: 0;
  right: 24%;
  left: 24%;
  height: 0.1875rem;
  border-radius: 0 0 9999px 9999px;
  background: transparent;
  content: "";
}

.mobile-bottom-navigation__item:is(:hover, :focus-visible),
.mobile-bottom-navigation__item.is-active {
  color: #0165a3;
}

.mobile-bottom-navigation__item:focus-visible {
  z-index: 1;
  outline: 2px solid #0c9feb;
  outline-offset: -3px;
}

.mobile-bottom-navigation__item.is-active::before {
  background: #0c9feb;
}

.mobile-bottom-navigation__icon {
  font-size: 1.25rem;
  line-height: 1.25rem;
}

/* 기존 드로어가 열린 경우에만 하단 메뉴를 숨기며, 전체메뉴 전용 페이지에는 적용하지 않습니다. */
.is-common-mobile-menu-open .mobile-bottom-navigation {
  display: none;
}
