/* ==========================================================================
   medtopo-topnav.css — SHARED top navigation styles.
   Loaded by every page (including those with their own bespoke design like
   acs.html, guide.html, pdd.html). Edit here → every page updates on deploy.

   The nav is injected by medtopo.js's initTopNav() as ONE standalone global bar
   prepended at the top of <body>. It is identical on every page — same Home
   button + specialty dropdowns, same placement — and only the active highlight
   (current page's specialty / Home) changes from page to page.
   Uses CSS custom-property fallbacks so pages without medtopo.css still theme.
   ========================================================================== */

/* Full-width global strip at the very top of every page. Kept NON-sticky so it
   never collides with the various per-page sticky headers (each page pins its
   own header at top:0 as designed); this bar simply scrolls with the page.
   High z-index so its dropdowns overlay any page header while open. */
.medtopo-topbar {
  position: relative;
  z-index: 500;
  background: var(--surface, #fbf6ea);
  border-bottom: 1px solid var(--border, #d0c3a7);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}
.medtopo-topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  align-items: stretch;
}

/* Home button */
.medtopo-top-home {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--text-dim, #5e5344);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.medtopo-top-home:hover {
  color: var(--sienna-deep, #7a3e27);
  background: rgba(162, 90, 58, 0.08);
}
.medtopo-top-home.is-current {
  color: var(--sienna-deep, #7a3e27);
  border-bottom-color: var(--sienna, #a25a3a);
  background: rgba(162, 90, 58, 0.10);
}
.medtopo-top-home-icon { display: inline-flex; }
.medtopo-top-home-icon svg { width: 17px; height: 17px; display: block; }
/* Subtle divider between Home and the specialties */
.medtopo-top-home { margin-right: 6px; border-right: 1px solid var(--border, #d0c3a7); padding-right: 16px; }
/* Tools link reuses the home-button styling but sits at the far right as a utility. */
.medtopo-top-tools { margin-left: auto; margin-right: 0; border-right: none; border-left: 1px solid var(--border, #d0c3a7); padding-right: 0; padding-left: 16px; }

.medtopo-top-item { position: relative; }

.medtopo-top-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-dim, #5e5344);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.medtopo-top-btn:hover {
  color: var(--sienna-deep, #7a3e27);
  background: rgba(162, 90, 58, 0.08);
}
.medtopo-top-item.is-current .medtopo-top-btn {
  color: var(--sienna-deep, #7a3e27);
  font-weight: 800;
  background: rgba(162, 90, 58, 0.09);
  border-bottom-color: var(--sienna, #a25a3a);
}
.medtopo-top-item.open .medtopo-top-btn {
  color: var(--text, #2a241c);
  background: rgba(162, 90, 58, 0.10);
}
.medtopo-top-icon { font-size: 1rem; line-height: 1; }
.medtopo-top-chev {
  font-size: 0.68rem;
  opacity: 0.55;
  transition: transform 0.2s ease;
  margin-left: 2px;
}
.medtopo-top-item.open .medtopo-top-chev { transform: rotate(180deg); opacity: 0.9; }

.medtopo-top-drop {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 280px;
  max-width: 360px;
  background: var(--surface, #fbf6ea);
  border: 1px solid var(--border, #d0c3a7);
  border-radius: 0 0 12px 12px;
  border-top: 0;
  box-shadow: 0 14px 28px -10px rgba(60, 40, 20, 0.28);
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 1000;
}
/* Anchor the last items' dropdowns to their right edge so they don't
   overflow the right edge of the viewport. */
.medtopo-top-item.align-right .medtopo-top-drop {
  left: auto;
  right: 0;
}
.medtopo-top-item.open .medtopo-top-drop { display: flex; }

/* Direct page entry in dropdown (e.g. ACS, IV Fluids) */
.medtopo-drop-page {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--text, #2a241c);
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}
.medtopo-drop-page:hover {
  background: rgba(162, 90, 58, 0.10);
  color: var(--sienna-deep, #7a3e27);
}
.medtopo-drop-page.is-current {
  background: rgba(162, 90, 58, 0.14);
  color: var(--sienna-deep, #7a3e27);
}
.medtopo-drop-page-label { font-weight: 600; font-size: 0.9rem; }
.medtopo-drop-page-desc {
  font-size: 0.74rem;
  color: var(--text-muted, #8a7c65);
  line-height: 1.35;
}

/* Subgroup header link (clickable — goes to the subgroup's main page) */
.medtopo-drop-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--text, #2a241c);
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}
.medtopo-drop-group-head:hover {
  background: rgba(162, 90, 58, 0.10);
  color: var(--sienna-deep, #7a3e27);
}
.medtopo-drop-group-head.is-current {
  background: rgba(162, 90, 58, 0.14);
  color: var(--sienna-deep, #7a3e27);
}
.medtopo-drop-group-head .medtopo-drop-arrow {
  color: var(--text-muted, #8a7c65);
  font-size: 0.9rem;
  transition: transform 0.15s ease, color 0.15s ease;
}
.medtopo-drop-group-head:hover .medtopo-drop-arrow {
  transform: translateX(3px);
  color: var(--sienna-deep, #7a3e27);
}

/* Small sub-pages list inside a subgroup */
.medtopo-drop-sublist {
  list-style: none;
  margin: 0 4px 4px 24px;
  padding: 2px 0 2px 10px;
  border-left: 2px solid rgba(185, 169, 136, 0.55);
  display: flex;
  flex-direction: column;
}
.medtopo-drop-sublist li { margin: 0; }
.medtopo-drop-sublist li a {
  display: block;
  padding: 5px 8px;
  text-decoration: none;
  font-size: 0.76rem;
  color: var(--text-muted, #8a7c65);
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
  line-height: 1.3;
}
.medtopo-drop-sublist li a:hover {
  background: rgba(162, 90, 58, 0.08);
  color: var(--sienna-deep, #7a3e27);
}
.medtopo-drop-sublist li a.is-current {
  color: var(--sienna-deep, #7a3e27);
  background: rgba(162, 90, 58, 0.12);
  font-weight: 600;
}

@media (max-width: 720px) {
  .medtopo-topbar-inner { padding: 0 10px; gap: 0; }
  .medtopo-top-home { padding: 9px 10px; gap: 6px; margin-right: 4px; padding-right: 10px; }
  .medtopo-top-home-label { font-size: 0.82rem; }
  .medtopo-top-btn { padding: 9px 8px; font-size: 0.82rem; gap: 5px; }
  .medtopo-top-label { font-size: 0.82rem; }
  .medtopo-top-drop {
    left: 0;
    right: 0;
    min-width: 0;
    max-width: none;
    border-radius: 0 0 10px 10px;
  }
}
/* Very narrow phones: hide specialty text labels, keep icons + Home */
@media (max-width: 460px) {
  .medtopo-top-label { display: none; }
  .medtopo-top-btn { padding: 9px 11px; }
}
