/* 电脑端悬停或键盘焦点展开，手机端点击展开，由 site.js 同步状态。 */
.topbar .nav-dropdown:not(.is-open)>.nav-sub {
  display: none !important
}

.topbar .nav-dropdown.is-open>.nav-sub {
  display: block
}

.topbar .nav-dropdown>button:after {
  display: inline-block;
  transition: transform .18s ease
}

.topbar .nav-dropdown.is-open>button:after {
  transform: rotate(180deg)
}

.topbar .nav a.nav-phone {
  display: none
}

@media(max-width:760px) {
  .topbar:has(.nav.open) {
    z-index: 200
  }

  .topbar :is(.nav a, .nav button, .menu) {
    -webkit-tap-highlight-color: rgba(214, 19, 25, .08)
  }

  .topbar .nav {
    top: var(--nav-top, 68px);
    left: 12px;
    right: 12px;
    padding: 10px;
    max-height: calc(100dvh - var(--nav-top, 68px) - 16px - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
    background: rgba(255, 255, 255, .84);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(31, 41, 55, .16)
  }

  .topbar .nav>a:not(.nav-phone),
  .topbar .nav-dropdown>button {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 14px;
    line-height: 1.5
  }

  .topbar .nav-dropdown>button {
    justify-content: space-between;
    width: 100%;
    text-align: left
  }

  .topbar .nav-dropdown.is-open>.nav-sub {
    display: grid
  }

  .topbar .nav-sub {
    position: static;
    width: auto;
    translate: none;
    padding: 3px 8px 5px 18px;
    margin: 0 8px 6px;
    border: 0;
    border-left: 2px solid rgba(214, 19, 25, .18);
    border-radius: 0;
    background: transparent;
    box-shadow: none
  }

  .topbar .nav-sub a {
    display: flex;
    align-items: center;
    min-height: 44px;
    background: transparent !important
  }

  .topbar .nav a.nav-phone,
  .topbar .nav a.nav-phone:focus-visible {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    margin: 8px 4px 4px;
    padding: 10px 12px;
    border: 1px solid #d61319 !important;
    border-radius: 8px;
    background: #d61319 !important;
    color: #fff !important;
    font-size: 15px;
    line-height: 1.5
  }

  .topbar .nav a.nav-phone:hover {
    background: #b80d16 !important;
    color: #fff !important
  }

  .topbar .nav a.nav-phone span {
    font-weight: 500
  }
}

@media(prefers-reduced-motion:reduce) {
  .topbar .nav-dropdown>button:after {
    transition: none
  }
}

/* Education viewpoints: shared category links on desktop and mobile. */
.topbar .nav-viewpoints>button.active {
  color: #d61319
}

.viewpoint-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 24px
}

.viewpoint-categories a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid #e1e4e8;
  border-radius: 8px;
  color: #424850;
  font-size: 16px;
  line-height: 1.5
}

.viewpoint-categories a.active,
.viewpoint-categories a:hover {
  background: #d61319;
  border-color: #d61319;
  color: #fff
}

@media(max-width:760px) {
  .viewpoint-categories {
    gap: 8px
  }

  .viewpoint-categories a {
    flex: 1;
    padding: 10px 8px;
    font-size: 15px
  }
}

/* 下拉面板紧接父菜单，鼠标移向子栏目时不会穿过空隙。 */
@media (min-width:1001px) {
  .topbar .nav-dropdown > .nav-sub {
    top:100%;
  }
  .topbar .nav-dropdown > .nav-sub::before {
    content:"";
    position:absolute;
    left:0;
    right:0;
    top:-10px;
    height:10px;
  }
}
