﻿/* The trimmed site menu (Views/Shared/_CompactMenu), which a member can choose on
   every page instead of the full header. compact-menu.js switches it and remembers
   the choice; _CompactMenuHead sets it on <html> before the page paints.
   The class names began on Waves (wv-), and are kept so nothing else moves. */

.wv-topbar {
  --wv-ink: var(--bb-sage-900);
  --wv-text: #3d4536;
  --wv-line: var(--bb-sage-200);
}

/* Trimmed: the site's header and menu bar give way to one slim line (.wv-topbar). */
html.wv-menu-compact .site-header,
html.wv-menu-compact .site-subheader {
  display: none;
}

.wv-topbar {
  display: none;
}

html.wv-menu-compact .wv-topbar {
  display: flex;
}

.wv-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  align-items: center;
  gap: 0.5rem;
  margin: 0.6rem 0 0.9rem;
  padding: 0.35rem 0.45rem 0.35rem 0.9rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--wv-line);
  border-radius: 0.9rem;
  box-shadow: 0 6px 18px rgba(30, 58, 138, 0.08);
}

.wv-topbar-brand {
  flex-shrink: 0;
  font-family: var(--brand-font);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--brand-book);
  text-decoration: none;
}

.wv-topbar-brand span {
  color: var(--brand-swing);
}

.wv-topbar-links {
  display: flex;
  flex: 0 1 auto;
  gap: 0.3rem;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.wv-topbar-links::-webkit-scrollbar {
  display: none;
}

.wv-topbar-links a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 0.7rem;
  border-radius: 0.6rem;
  color: var(--wv-text);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

/* The other links (Morning Shore, Play Hub) in the soft green chip of the full
   menu bar's other links (site.css .subheader-nav > a), blue on hover. */
.wv-topbar-links a {
  border: 1px solid #c5d2b0;
  background: #f3f6ef;
  color: var(--bb-sage-900);
}

.wv-topbar-links a:hover {
  border-color: var(--bb-blue-200);
  background: var(--bb-blue-50);
  color: var(--bb-blue-700);
}

[data-blog-theme="dark"] .wv-topbar-links a {
  border-color: #44513a;
  background: var(--blog-night-raised);
  color: var(--blog-night-text);
}

[data-blog-theme="dark"] .wv-topbar-links a:hover {
  border-color: var(--blog-night-link);
  background: var(--blog-night-surface);
  color: var(--blog-night-link);
}

.wv-topbar-links a.is-active {
  background: #1e3a8a;
  color: #fff;
}

/* Books, Blog, Waves, Finds, Discover and Memories as capsules in the colours of their
   buttons in the full menu bar (site.css), and Chat in violet, each a shade
   deeper on hover. The page you're on keeps its colour, deeper, with a thin
   white ring. */
.wv-topbar-links a.wv-topbar-books { --wv-cap: #1d4ed8; --wv-cap-deep: #1e3a8a; }
.wv-topbar-links a.wv-topbar-blog { --wv-cap: #536440; --wv-cap-deep: #2c3623; }
.wv-topbar-links a.wv-topbar-waves { --wv-cap: #0e7490; --wv-cap-deep: #155e75; }
.wv-topbar-links a.wv-topbar-finds { --wv-cap: #b8901f; --wv-cap-deep: #977518; }
.wv-topbar-links a.wv-topbar-discover { --wv-cap: #166534; --wv-cap-deep: #14532d; }
.wv-topbar-links a.wv-topbar-memory { --wv-cap: #b4532a; --wv-cap-deep: #8f3f1e; }
.wv-topbar-links a.wv-topbar-chat { --wv-cap: #4b3fc4; --wv-cap-deep: #3a2fa3; }

.wv-topbar-links a:is(.wv-topbar-books, .wv-topbar-blog, .wv-topbar-waves, .wv-topbar-finds, .wv-topbar-discover, .wv-topbar-memory, .wv-topbar-chat) {
  border-color: var(--wv-cap);
  background: var(--wv-cap);
  color: #fff;
}

.wv-topbar-links a:is(.wv-topbar-books, .wv-topbar-blog, .wv-topbar-waves, .wv-topbar-finds, .wv-topbar-discover, .wv-topbar-memory, .wv-topbar-chat):is(:hover, :focus-visible, .is-active) {
  border-color: var(--wv-cap-deep);
  background: var(--wv-cap-deep);
  color: #fff;
}

.wv-topbar-links a:is(.wv-topbar-books, .wv-topbar-blog, .wv-topbar-waves, .wv-topbar-finds, .wv-topbar-discover, .wv-topbar-memory, .wv-topbar-chat).is-active {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.wv-topbar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--bb-blue-700);
  cursor: pointer;
}

.wv-topbar-icon svg {
  width: 18px;
  height: 18px;
}

.wv-topbar-icon:hover {
  background: var(--bb-sage-100);
  color: var(--bb-blue-700);
}

/* Who's signed in: initial, a green "online" dot and the first name. */
.wv-topbar-me {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  max-width: 11rem;
  padding: 0.2rem 0.75rem 0.2rem 0.2rem;
  border: 1px solid var(--wv-line);
  border-radius: 999px;
  background: var(--bb-sage-100);
  color: var(--wv-ink);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
}

.wv-topbar-me:hover {
  color: var(--wv-ink);
  border-color: var(--bb-sage-600);
}

.wv-topbar-me-avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--bb-gold-500);
  color: var(--bb-blue-900);
  font-size: 0.9rem;
  font-weight: 800;
}

.wv-topbar-me-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px #fff;
  animation: wv-online 2.4s ease-in-out infinite;
}

@keyframes wv-online {
  0%, 100% { box-shadow: 0 0 0 2px #fff, 0 0 0 2px rgba(34, 197, 94, 0.45); }
  50% { box-shadow: 0 0 0 2px #fff, 0 0 0 6px rgba(34, 197, 94, 0); }
}

.wv-topbar-me-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The account menu under the name: Profile and Sign out. */
.wv-topbar-account {
  position: relative;
  flex-shrink: 0;
}

.wv-topbar-account > summary {
  list-style: none;
  cursor: pointer;
}

.wv-topbar-account > summary::-webkit-details-marker {
  display: none;
}

.wv-topbar-me-chevron {
  width: 13px;
  height: 13px;
  margin-left: -0.15rem;
  color: var(--bb-sage-700);
  transition: transform 0.15s;
}

.wv-topbar-account[open] .wv-topbar-me-chevron {
  transform: rotate(180deg);
}

.wv-topbar-account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 35;
  display: flex;
  flex-direction: column;
  width: 230px;
  padding: 0.4rem;
  border: 1px solid var(--wv-line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
}

.wv-topbar-account-who {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0.45rem 0.6rem 0.6rem;
  margin-bottom: 0.3rem;
  border-bottom: 1px solid var(--bb-sage-100);
  line-height: 1.3;
}

.wv-topbar-account-who strong {
  color: var(--wv-ink);
  font-size: 0.9rem;
}

.wv-topbar-account-who span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--bb-sage-700);
  font-size: 0.78rem;
}

.wv-topbar-account-menu form {
  margin: 0;
}

.wv-topbar-account-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--wv-ink);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.wv-topbar-account-item:hover {
  background: var(--bb-sage-100);
  color: var(--wv-ink);
}

.wv-topbar-account-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.wv-topbar-signin {
  flex-shrink: 0;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: var(--bb-blue-600);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
}

.wv-topbar-signin:hover {
  color: #fff;
  background: var(--bb-blue-700);
}

/* Pages that are always trimmed (Shore Discover): the toggle is disabled, and a
   click shows why under it (compact-menu.js). */
html.wv-menu-locked .menu-switch {
  position: relative;
}

html.wv-menu-locked .menu-switch button {
  opacity: 0.5;
  cursor: not-allowed;
}

.menu-switch-tip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  z-index: 40;
  width: max-content;
  max-width: 210px;
  padding: 0.35rem 0.6rem;
  border-radius: 0.5rem;
  background: var(--bb-sage-900);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  transform: translateX(-50%);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
}

[data-blog-theme="dark"] .menu-switch-tip {
  background: var(--blog-night-raised);
  color: var(--blog-night-text);
  border: 1px solid #44513a;
}

/* The lines around the toggle. */
.wv-pipe {
  flex: none;
  align-self: center;
  width: 1px;
  height: 24px;
  margin: 0 0.25rem;
  background: #c5d2b0;
}

.wv-topbar-tools,
.wv-topbar-alerts {
  display: flex;
  flex: none;
  align-items: center;
}

/* The bell and cart, in the size of the icons beside them. */
.wv-topbar-alerts .header-action-btn {
  position: relative;
  width: 36px;
  height: 36px;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
}

.wv-topbar-alerts .header-action-icon {
  width: 19px;
  height: 19px;
  color: var(--bb-blue-700);
}

/* Search, night mode, the bell and the cart at night, in the full menu's colour too. */
[data-blog-theme="dark"] .wv-topbar-icon,
[data-blog-theme="dark"] .wv-topbar-icon:hover,
[data-blog-theme="dark"] .wv-topbar-alerts .header-action-icon {
  color: var(--blog-night-link);
}

/* The space on the bar goes after Explore More, so the toggle, search, night mode,
   bell and cart always sit together at the right, next to the user menu. */
.wv-topbar .ex {
  margin-right: auto;
}

/* The name's logo shows only on phones, where the words don't fit. */
.wv-topbar-brand img {
  display: none;
}

.wv-topbar-brand b {
  font-weight: inherit;
}

/* My Activity and Admin beside Chat, in their own colours (site.css), from the
   same size as the other items here. They're in Explore More on smaller screens. */
.wv-topbar-staff.subheader-nav {
  display: flex;
  flex: none;
  gap: 0.3rem;
}

.wv-topbar-staff .subheader-nav-toggle {
  height: 34px;
  padding: 0 0.6rem;
  font-size: 0.86rem;
}

@media (min-width: 1280px) {
  .ex-small-screens {
    display: none;
  }
}

@media (min-width: 1100px) {
  /* The bar needs more room than the page's own width, so it spreads wider,
     staying centred. "html body" outranks Discover's own margin. */
  html body .wv-topbar {
    --wv-bar: min(calc(100vw - 48px), 1320px);
    width: var(--wv-bar);
    margin-left: calc((100% - var(--wv-bar)) / 2);
  }
}

@media (max-width: 1279.98px) {
  .wv-topbar-staff.subheader-nav {
    display: none;
  }
}

/* The user menu is just its icon, the initial with its dot, to leave room for the rest. */
.wv-topbar-me {
  padding: 0.15rem;
}

.wv-topbar-me-name,
.wv-topbar-me-chevron {
  display: none;
}

/* On smaller laptops the name gives way to the logo. */
@media (min-width: 1100px) and (max-width: 1319.98px) {
  .wv-topbar-brand img {
    display: block;
  }

  .wv-topbar-brand b {
    display: none;
  }
}

/* ---------- Explore More: soft green throughout, every item the same chip ---------- */
.ex {
  position: relative;
  flex: none;
}

.ex-btn,
.ex-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  min-height: 34px;
  padding: 0 0.7rem;
  border: 1px solid #c5d2b0;
  border-radius: 0.6rem;
  background: #f3f6ef;
  color: var(--bb-sage-900);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.ex-chip {
  width: 100%;
  text-align: left;
}

.ex-btn:hover,
.ex-btn[aria-expanded="true"],
.ex-chip:hover,
.ex-chip[aria-expanded="true"] {
  border-color: var(--bb-blue-200);
  background: var(--bb-blue-50);
  color: var(--bb-blue-700);
}

.ex-chevron {
  flex: none;
  width: 12px;
  height: 12px;
  transition: transform 0.15s;
}

.ex-btn[aria-expanded="true"] .ex-chevron {
  transform: rotate(180deg);
}

/* In the panel the arrow points to where the sub-menu opens. */
.ex-chip .ex-chevron {
  transform: rotate(-90deg);
}

.ex-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.ex-tag {
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--bb-gold-400);
  color: var(--bb-sage-900);
  font-size: 0.66rem;
  font-weight: 800;
}

.ex-panel,
.ex-sub {
  display: grid;
  gap: 0.3rem;
  padding: 0.5rem;
  border: 1px solid #c5d2b0;
  border-radius: 0.75rem;
  background: #e5eadb;
  box-shadow: 0 14px 32px rgba(44, 54, 35, 0.2);
}

.ex-panel[hidden],
.ex-sub[hidden] {
  display: none;
}

.ex-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 35;
  width: 226px;
}

/* A sub-menu sits level with its item: up by the panel's padding and border, so
   the first chips line up. compact-menu.js moves it when it wouldn't fit. */
.ex-item {
  position: relative;
}

.ex-sub {
  --ex-shift: 0px;
  position: absolute;
  top: calc(-0.5rem - 1px + var(--ex-shift));
  left: calc(100% + 0.5rem + 6px);
  z-index: 36;
  width: 210px;
  max-height: calc(100vh - 16px);
  overflow-y: auto;
}

.ex-sub.is-flipped {
  right: calc(100% + 0.5rem + 6px);
  left: auto;
}

/* My Activity and Admin: dozens of links, in small labelled groups, three to a
   row so the panel stays short enough to sit near its item. */
.ex-sub-wide {
  width: min(580px, calc(100vw - 32px));
  gap: 0.35rem;
}

.ex-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.25rem 0.3rem;
  min-width: 0;
}

.ex-group h6 {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0 0.2rem;
  color: var(--bb-sage-700);
  font-size: 0.72rem;
  font-weight: 800;
}

.ex-sub-wide .ex-chip {
  display: block;
  min-height: 0;
  padding: 0.25rem 0.5rem;
  overflow: hidden;
  font-size: 0.78rem;
  text-overflow: ellipsis;
}

.ex-phone-tools {
  display: none;
}

[data-blog-theme="dark"] .ex-panel,
[data-blog-theme="dark"] .ex-sub {
  border-color: #44513a;
  background: var(--blog-night-surface);
}

[data-blog-theme="dark"] .ex-btn,
[data-blog-theme="dark"] .ex-chip {
  border-color: #44513a;
  background: var(--blog-night-raised);
  color: var(--blog-night-text);
}

[data-blog-theme="dark"] .ex-btn:hover,
[data-blog-theme="dark"] .ex-btn[aria-expanded="true"],
[data-blog-theme="dark"] .ex-chip:hover,
[data-blog-theme="dark"] .ex-chip[aria-expanded="true"] {
  border-color: var(--blog-night-link);
  color: var(--blog-night-link);
}

[data-blog-theme="dark"] .ex-group h6 {
  color: var(--blog-night-text);
}

[data-blog-theme="dark"] .wv-pipe {
  background: #44513a;
}

/* Phones, small tablets and unfolded foldables. */
@media (max-width: 1099.98px) {
  /* Two lines: the name, Explore More, toggle and account, then the bold items sliding. */
  .wv-topbar {
    flex-wrap: wrap;
    gap: 0.3rem;
  }

  .wv-topbar-alerts .header-action-btn {
    width: 32px;
  }

  /* The bell's panel spreads across the screen from the bar. */
  .wv-topbar .notifications {
    position: static;
  }

  .wv-pipe {
    margin: 0;
  }

  .ex-btn {
    padding: 0 0.5rem;
    font-size: 0.8rem;
  }

  .wv-topbar-brand {
    font-size: 0.95rem;
  }

  /* The toggle is one button, showing the style it switches to: three lines
     under the trimmed menu, one line under the full menu. */
  .menu-switch {
    padding: 0;
    border: 0;
    background: transparent;
  }

  .menu-switch button,
  .menu-switch button[aria-pressed="true"] {
    width: 30px;
    height: 30px;
    border: 1px solid var(--bb-sage-200);
    background: var(--bb-sage-100);
    color: var(--bb-sage-900);
    box-shadow: none;
  }

  html.wv-menu-compact .menu-switch [data-menu-set="compact"],
  html:not(.wv-menu-compact) .menu-switch [data-menu-set="full"] {
    display: none;
  }

  .wv-topbar-links {
    order: 9;
    flex: 1 0 100%;
  }

  .wv-topbar-icon {
    width: 30px;
    height: 32px;
  }

  /* Explore More spreads across the bar, and sub-menus open in place. */
  .ex {
    position: static;
  }

  .ex-panel {
    right: 0;
    width: auto;
    max-height: calc(100vh - 7rem);
    overflow-y: auto;
  }

  .ex-sub,
  .ex-sub.is-flipped {
    position: static;
    width: auto;
    margin: 0.3rem 0 0.2rem 0.6rem;
    max-height: none;
    padding: 0 0 0 0.5rem;
    border-width: 0 0 0 2px;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .ex-sub-wide .ex-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ex-chip .ex-chevron {
    transform: none;
  }

  .ex-chip[aria-expanded="true"] .ex-chevron {
    transform: rotate(180deg);
  }

}

/* Phones: search and night mode stay on the first line for as long as they fit,
   with the rest tightening up step by step to make room. */
@media (max-width: 409.98px) {
  .ex-btn-more {
    display: none;
  }
}

@media (max-width: 469.98px) {
  .wv-topbar {
    gap: 0.2rem;
  }

  .wv-topbar .wv-pipe {
    display: none;
  }

  .ex-btn {
    padding: 0 0.35rem;
  }

  .wv-topbar-brand {
    font-size: 0.9rem;
  }

  .wv-topbar-alerts .header-action-btn,
  .wv-topbar-icon {
    width: 28px;
  }

  .wv-topbar .menu-switch button,
  .wv-topbar .menu-switch button[aria-pressed="true"] {
    width: 28px;
  }
}

@media (max-width: 379.98px) {
  .ex-btn .ex-chevron {
    display: none;
  }

  .wv-topbar-alerts .header-action-btn,
  .wv-topbar-icon {
    width: 26px;
  }
}

/* The narrowest phones: search and night mode move into Explore More. */
@media (max-width: 354.98px) {
  .wv-topbar-tools {
    display: none;
  }

  .ex-phone-tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ex-chevron {
    transition: none;
  }
}

/* The Full / Trimmed toggle (_MenuToggle). */
.menu-switch {
  display: inline-flex;
  flex-shrink: 0;
  padding: 3px;
  border: 1px solid var(--bb-sage-200);
  border-radius: 999px;
  background: var(--bb-sage-100);
}

.menu-switch button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--bb-sage-700);
  cursor: pointer;
}

.menu-switch button svg {
  width: 15px;
  height: 15px;
}

.menu-switch button:hover {
  color: var(--bb-sage-900);
}

.menu-switch button[aria-pressed="true"] {
  background: #fff;
  color: #1e3a8a;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

@media (max-width: 1099.98px) {
  .wv-topbar {
    border-radius: 0.9rem;
    padding-left: 0.7rem;
  }

  /* Just the initial and its dot. */
  .wv-topbar-me {
    padding: 0.15rem;
  }

  .wv-topbar-me-name,
  .wv-topbar-me-chevron {
    display: none;
  }

}

@media (prefers-reduced-motion: reduce) {
  .wv-topbar-me-dot {
    animation: none;
  }
}
