/*
 * =========================================================
 * VRIMS ISOLATED MOBILE NAVIGATION
 * Prefix: vrm-mobile-
 * Breakpoint: <= 1280px (matches JS MOBILE_BP = 1280)
 *
 * This file ONLY touches .vrm-mobile-* classes.
 * Desktop navigation (.site-nav, .nm-*, etc.) is NOT modified here.
 * =========================================================
 */

/* =========================================================
   HAMBURGER TOGGLE BUTTON
   Hidden on desktop, shown on mobile/tablet.
   Position: right side of header (via header.php flex layout).
   ========================================================= */
.vrm-mobile-toggle {
  display: none; /* hidden by default (desktop) */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: #082b4c;
  flex-shrink: 0;
  z-index: 99990;
  position: relative;
}

.vrm-mobile-toggle:focus-visible {
  outline: 3px solid rgba(228, 119, 95, 0.5);
  outline-offset: 2px;
}

.vrm-mobile-toggle__bar {
  display: block;
  width: 24px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

/* Animate to X when open */
.vrm-mobile-toggle[aria-expanded="true"] .vrm-mobile-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.vrm-mobile-toggle[aria-expanded="true"] .vrm-mobile-toggle__bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.vrm-mobile-toggle[aria-expanded="true"] .vrm-mobile-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* =========================================================
   OVERLAY — behind the drawer, above everything else
   ========================================================= */
.vrm-mobile-overlay {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: rgba(4, 25, 43, 0.55);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.vrm-mobile-overlay.vrm-mobile-is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* =========================================================
   DRAWER — slides in from the LEFT
   ========================================================= */
.vrm-mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(88vw, 420px);
  height: 100dvh;
  z-index: 99999; /* above overlay (99998) */
  background: #ffffff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Hidden off-screen to the left */
  transform: translateX(-105%);
  transition: transform 0.35s ease;
  /* Do NOT use visibility:hidden — keep it accessible to screen readers */
}

.vrm-mobile-drawer.vrm-mobile-is-open {
  transform: translateX(0);
}

/* =========================================================
   DRAWER HEADER — fixed inside drawer, not scrollable
   ========================================================= */
.vrm-mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 14px 18px;
  border-bottom: 1px solid #dce8e7;
  background: #f7fbfa;
}

.vrm-mobile-title {
  color: #082b4c;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.vrm-mobile-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 50%;
  color: #082b4c;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}

.vrm-mobile-close:hover,
.vrm-mobile-close:focus-visible {
  background: #edf7f6;
  outline: none;
}

/* =========================================================
   SCROLLABLE CONTENT AREA
   flex: 1 + min-height: 0 is required to make overflow-y work
   inside a flex container.
   ========================================================= */
.vrm-mobile-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 40px;
}

/* =========================================================
   MENU LIST
   ========================================================= */
.vrm-mobile-list {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

/* =========================================================
   TOP-LEVEL MENU ITEMS
   ========================================================= */
.vrm-mobile-item {
  display: block;
  border-bottom: 1px solid #dce8e7;
}

/* Direct link item (no children) */
.vrm-mobile-link {
  display: block;
  padding: 15px 20px;
  color: #082b4c;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  background: #ffffff;
  transition: background 0.15s ease, color 0.15s ease;
}

.vrm-mobile-link:hover,
.vrm-mobile-link:focus-visible {
  background: #edf7f6;
  color: #0f8b8d;
  outline: none;
}

/* =========================================================
   EXPANDABLE ROW (items with children)
   The row contains a label + expand button.
   ========================================================= */
.vrm-mobile-row {
  display: flex;
  align-items: stretch;
  min-height: 52px;
  background: #ffffff;
}

.vrm-mobile-label {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  padding: 14px 20px;
  color: #082b4c;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: default;
  user-select: none;
}

.vrm-mobile-expand {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  min-height: 52px;
  padding: 0;
  background: none;
  border: none;
  border-left: 1px solid #dce8e7;
  color: #082b4c;
  cursor: pointer;
  transition: background 0.15s ease;
}

.vrm-mobile-expand:hover,
.vrm-mobile-expand:focus-visible {
  background: #edf7f6;
  outline: none;
}

/* Arrow icon inside expand button */
.vrm-mobile-expand__arrow {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #e4775f;
  transition: transform 0.25s ease;
}

/* Rotate arrow when open */
.vrm-mobile-has-children.vrm-mobile-is-open > .vrm-mobile-row .vrm-mobile-expand__arrow {
  transform: rotate(180deg);
}

/* =========================================================
   FIRST-LEVEL SUBMENU
   Expands naturally inside the drawer — NO absolute positioning.
   ========================================================= */
.vrm-mobile-submenu {
  display: none;
  position: static;
  width: 100%;
  background: #f0f7f6;
  list-style: none;
  margin: 0;
  padding: 0;
}

.vrm-mobile-has-children.vrm-mobile-is-open > .vrm-mobile-submenu {
  display: block;
}

/* Items inside first-level submenu */
.vrm-mobile-sub-item {
  display: block;
  border-bottom: 1px solid #dce8e7;
}

/* Direct link inside submenu */
.vrm-mobile-sub-link {
  display: block;
  padding: 12px 20px 12px 36px;
  color: #173044;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.vrm-mobile-sub-link:hover,
.vrm-mobile-sub-link:focus-visible {
  background: #e4f0ef;
  color: #0b6280;
  outline: none;
}

/* Document link icon */
.vrm-mobile-doc-icon {
  margin-right: 5px;
  font-size: 11px;
  opacity: 0.7;
}

/* External link arrow */
.vrm-mobile-ext-arrow {
  margin-left: 3px;
  font-size: 11px;
  opacity: 0.65;
}

/* =========================================================
   NESTED ITEMS (sub-group inside first-level submenu)
   Example: "Pre Clinical" inside "Departments"
   ========================================================= */
.vrm-mobile-nested-item {
  display: block;
  border-bottom: 1px solid #dce8e7;
}

.vrm-mobile-nested-row {
  display: flex;
  align-items: stretch;
  min-height: 46px;
  background: #f0f7f6;
}

.vrm-mobile-nested-label {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  padding: 12px 20px 12px 36px;
  color: #082b4c;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: default;
  user-select: none;
}

.vrm-mobile-nested-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  min-height: 46px;
  padding: 0;
  background: none;
  border: none;
  border-left: 1px solid #dce8e7;
  color: #082b4c;
  cursor: pointer;
  transition: background 0.15s ease;
}

.vrm-mobile-nested-toggle:hover,
.vrm-mobile-nested-toggle:focus-visible {
  background: #e4f0ef;
  outline: none;
}

.vrm-mobile-nested-toggle__arrow {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #e4775f;
  transition: transform 0.25s ease;
}

/* Rotate nested arrow when open */
.vrm-mobile-nested-item.vrm-mobile-is-open > .vrm-mobile-nested-row .vrm-mobile-nested-toggle__arrow {
  transform: rotate(180deg);
}

/* =========================================================
   NESTED MENU (third level — links inside a sub-group)
   ========================================================= */
.vrm-mobile-nested-menu {
  display: none;
  position: static;
  width: 100%;
  background: #e4f0ef;
  list-style: none;
  margin: 0;
  padding: 0;
}

.vrm-mobile-nested-item.vrm-mobile-is-open > .vrm-mobile-nested-menu {
  display: block;
}

/* Links inside nested menu */
.vrm-mobile-nested-link {
  display: block;
  padding: 11px 20px 11px 52px;
  color: #173044;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid #dce8e7;
  transition: background 0.15s ease, color 0.15s ease;
}

.vrm-mobile-nested-link:hover,
.vrm-mobile-nested-link:focus-visible {
  background: #d8eceb;
  color: #0b6280;
  outline: none;
}

/* =========================================================
   ADMISSIONS CTA inside drawer
   ========================================================= */
.vrm-mobile-cta-wrap {
  padding: 16px;
}

.vrm-mobile-cta {
  display: block;
  padding: 14px 20px;
  background: #e4775f;
  color: #ffffff;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.vrm-mobile-cta:hover,
.vrm-mobile-cta:focus-visible {
  background: #c85d49;
  outline: none;
}

/* =========================================================
   BODY LOCK when drawer is open
   ========================================================= */
body.vrm-mobile-navigation-active {
  overflow: hidden;
}

/* =========================================================
   SHOW ON MOBILE / HIDE ON DESKTOP
   Breakpoint matches --nav-desktop-bp: 1280px in main.css
   ========================================================= */
@media (min-width: 1281px) {
  /* On desktop: hide ALL new mobile elements */
  .vrm-mobile-toggle,
  .vrm-mobile-drawer,
  .vrm-mobile-overlay {
    display: none !important;
  }
}

@media (max-width: 1280px) {
  /* On mobile/tablet: show the new hamburger */
  .vrm-mobile-toggle {
    display: flex;
  }

  /*
   * Hide the OLD desktop nav drawer on mobile.
   * The desktop nav (.site-nav) is a fixed drawer on mobile in the old system.
   * We replace it entirely with the new vrm-mobile- drawer.
   * Using visibility:hidden + pointer-events:none rather than display:none
   * so the old JS doesn't error (it still finds #main-navigation in DOM).
   */
  .site-nav {
    visibility: hidden !important;
    pointer-events: none !important;
    transform: translateX(200%) !important;
  }

  /* Hide old overlay — vrm-mobile-overlay handles it now */
  .nav-overlay {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  /* Hide the old hamburger — new vrm-mobile-toggle replaces it */
  .nav-hamburger {
    display: none !important;
  }

  /*
   * Remove backdrop-filter from site-header at mobile so the new
   * vrm-mobile-drawer (position:fixed) is not trapped inside the
   * sticky header's stacking context.
   */
  .site-header {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}
