/* Section dropdowns in the global top row — see program-menu.js. */

.pmenu-row {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  flex-shrink: 0;
}

/* A section is two targets: its name opens the section, the caret opens its menu.
   Hovering the pair opens the menu on a desktop as well. */
.pmenu-trigger {
  display: inline-flex;
  align-items: stretch;
  padding: 0;
  cursor: default;
}
.pmenu-go {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.6rem 0.15rem 0.6rem 0.7rem;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  border-radius: 10px 0 0 10px;
}
.pmenu-trigger .pmenu-caret {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.8em;
  opacity: 0.7;
  padding: 0 0.6rem 0 0.35rem;
  cursor: pointer;
  border-radius: 0 10px 10px 0;
  transition: transform 0.15s ease;
}
.pmenu-trigger .pmenu-caret:hover {
  opacity: 1;
}
.pmenu-trigger--open {
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.1);
}
.pmenu-trigger--open .pmenu-caret {
  transform: rotate(180deg);
}
/* The section you are in: a quiet underline, not the filled "active" pill the
   section row below already uses for the page. */
.pmenu-trigger--here .pmenu-label {
  box-shadow: inset 0 -2px 0 #2563eb;
}
.pmenu-lock {
  font-size: 0.72em;
  opacity: 0.75;
}

.pmenu-sheet-trigger {
  display: none;
}

/* ---------- desktop dropdown ---------- */

.pmenu-panel,
.pmenu-flyout {
  position: fixed;
  z-index: 60;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.06);
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.pmenu-panel {
  width: 290px;
}
.pmenu-flyout {
  width: 320px;
}

.pmenu-itemwrap {
  position: relative;
  display: flex;
  align-items: stretch;
  border-radius: 8px;
}
.pmenu-itemwrap:hover,
.pmenu-itemwrap--open {
  background: #eff6ff;
}

.pmenu-item {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  color: #1e293b;
  font-weight: 600;
  font-size: 0.93rem;
  text-decoration: none;
}
.pmenu-item:focus-visible,
.pmenu-more:focus-visible,
.pmenu-chip:focus-visible,
.pmenu-child:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}
.pmenu-item.active {
  color: #1d4ed8;
}
.pmenu-ico {
  width: 1.3em;
  text-align: center;
  flex-shrink: 0;
}
.pmenu-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pmenu-item .pmenu-lock,
.pmenu-item .pmenu-free {
  margin-left: auto;
  flex-shrink: 0;
}
.pmenu-free {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #15803d;
  background: #dcfce7;
  border-radius: 999px;
  padding: 1px 7px;
}

.pmenu-more {
  appearance: none;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 1rem;
  padding: 0 0.6rem;
  border-radius: 8px;
  cursor: pointer;
}
.pmenu-more:hover {
  color: #1d4ed8;
}

.pmenu-empty {
  padding: 0.6rem;
  color: #94a3b8;
}

.pmenu-flyout-title {
  position: sticky;
  top: -6px;
  background: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #64748b;
  padding: 0.45rem 0.6rem 0.35rem;
  margin: -6px -6px 2px;
  border-bottom: 1px solid #f1f5f9;
}

.pmenu-child {
  display: block;
  padding: 0.42rem 0.6rem;
  border-radius: 7px;
  color: #1e293b;
  font-size: 0.9rem;
  text-decoration: none;
}
.pmenu-child:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

.pmenu-bookrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.28rem 0.5rem;
  border-radius: 7px;
}
.pmenu-bookrow:hover {
  background: #f8fafc;
}
.pmenu-book {
  font-size: 0.88rem;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
}
.pmenu-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.pmenu-chip {
  min-width: 28px;
  text-align: center;
  padding: 3px 0;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  text-decoration: none;
}
.pmenu-chip:hover {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

/* ---------- phones: one "Sections" button, accordion sheet ---------- */

@media (max-width: 900px) {
  .pmenu-trigger {
    display: none;
  }
  .pmenu-sheet-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.75rem;
  }
  /* The menu button leads the row, and the row keeps its own width — squeezed
     by the sign-in buttons it used to shrink to a sliver showing "⌂ H". */
  #pmenuRoot {
    order: -1;
  }
  #platformTopNav .platform-top-nav-inner {
    flex: 0 0 auto;
  }
}

@media (max-width: 520px) {
  #platformTopNav {
    padding: 0 8px;
  }
  .pmenu-sheet-lbl {
    display: none;
  }
  .pmenu-burger {
    font-size: 1.15rem;
    line-height: 1;
  }
  /* Home and Teacher mode keep their icon; the words go on the narrowest screens. */
  #platformTopNav .platform-top-nav-home,
  #platformTopNav .platform-top-nav-teacher {
    font-size: 0;
    padding: 0.55rem 0.6rem;
  }
  #platformTopNav .platform-top-nav-home .platform-top-nav-home-ico,
  #platformTopNav .platform-top-nav-teacher .platform-top-nav-home-ico {
    font-size: 1.1rem;
  }
  #platformTopNav .n1-lang-switch-sel {
    max-width: 92px;
  }
}

.pmenu-sheet {
  position: fixed;
  z-index: 60;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.18);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 10px 14px;
}
.pmenu-sheet-sec + .pmenu-sheet-sec {
  border-top: 1px solid #f1f5f9;
}
.pmenu-sheet-head {
  display: flex;
  align-items: stretch;
}
.pmenu-sheet-go {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.85rem 0.4rem;
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
  text-decoration: none;
}
.pmenu-sheet-head.active .pmenu-label {
  color: #1d4ed8;
}
.pmenu-sheet-head .pmenu-caret {
  appearance: none;
  border: 0;
  border-left: 1px solid #f1f5f9;
  background: transparent;
  color: #64748b;
  font-size: 0.95rem;
  padding: 0 1.1rem;
  cursor: pointer;
}
.pmenu-sheet-body {
  padding: 0 0 8px 6px;
}
.pmenu-sheet .pmenu-item {
  padding: 0.62rem 0.6rem;
  font-size: 0.97rem;
}
.pmenu-sub {
  width: 100%;
  padding: 2px 0 8px 1.9rem;
}
.pmenu-sheet .pmenu-itemwrap {
  flex-wrap: wrap;
}
.pmenu-sheet .pmenu-more {
  font-size: 0.95rem;
  padding: 0 0.9rem;
}

/* ---------- the top row steps aside while scrolling down ---------- */

#platformTopNav,
#n1SectionNav {
  transition: transform 0.2s ease;
}
html.pmenu-away #platformTopNav {
  transform: translateY(-100%);
}
html.pmenu-away #n1SectionNav {
  transform: translateY(calc(-1 * var(--n1-topnav-h, 0px)));
}
@media (prefers-reduced-motion: reduce) {
  #platformTopNav,
  #n1SectionNav {
    transition: none;
  }
}
