/* ============================================================
   ICONIC Human Design Education, PMA — Mobile Navigation Drawer
   Hamburger menu for ≤768px breakpoints
   Colors: #633a85 (purple), #34d2e2 (teal), #000 (bg)
   ============================================================ */

/* ---- Hide existing in-page nav on mobile ------------------ */
@media (max-width: 768px) {
  /* Hide the page's built-in nav bar; replaced by sticky mobile header */
  nav:not(.mobile-nav-drawer):not([class*="admin"]):not(.center-pills-nav) {
    display: none !important;
  }
  /* Also hide any nav wrapper divs that just contain the logo+links */
  .nav-wrapper:not(.mobile-nav-drawer) {
    display: none !important;
  }
  /* Ensure body doesn't overflow horizontally.
     html must also be set so position:fixed elements (chatbot widget) remain
     anchored to the viewport on iOS Safari (not scroll with the page). */
  html, body { overflow-x: hidden; }
}

/* ---- Sticky mobile header --------------------------------- */
.mobile-header {
  display: none;
}

@media (max-width: 768px) {
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid rgba(99, 58, 133, 0.25);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
    min-height: 56px;
  }

  /* Push content below sticky header */
  body.has-mobile-nav {
    padding-top: 56px;
  }

  /* Logo in mobile header */
  .mobile-header .mobile-logo {
    font-family: 'Rubik', sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #633a85;
    text-decoration: none;
    line-height: 1;
  }
  .mobile-header .mobile-logo span {
    color: #A89FA0;
    font-weight: 400;
  }
}

/* ---- Hamburger button ------------------------------------- */
.hamburger-btn {
  display: none;
}

@media (max-width: 768px) {
  .hamburger-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background 0.2s;
    flex-shrink: 0;
  }
  .hamburger-btn:hover,
  .hamburger-btn:focus {
    background: rgba(99, 58, 133, 0.15);
    outline: none;
  }
  .hamburger-btn .ham-bar {
    display: block;
    width: 22px;
    height: 2px;
    background: #E8E6E1;
    border-radius: 2px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s ease;
    transform-origin: center;
  }
  .hamburger-btn.is-open .ham-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .hamburger-btn.is-open .ham-bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }
  .hamburger-btn.is-open .ham-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

/* ---- Overlay ---------------------------------------------- */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 9001;
  opacity: 0;
  transition: opacity 0.3s ease;
  cursor: pointer;
}
.mobile-nav-overlay.is-visible {
  display: block;
}
.mobile-nav-overlay.is-open {
  opacity: 1;
}

/* ---- Drawer panel ----------------------------------------- */
.mobile-nav-drawer {
  display: flex !important; /* override any nav hiding */
  position: fixed !important;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 92vw);
  background: #0d0d0d;
  border-left: 1px solid rgba(99, 58, 133, 0.25);
  z-index: 9002;
  transform: translateX(110%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  overflow-x: hidden;
  flex-direction: column !important;
  -webkit-overflow-scrolling: touch;
}
.mobile-nav-drawer.is-open {
  transform: translateX(0);
}

/* scrollbar */
.mobile-nav-drawer::-webkit-scrollbar { width: 4px; }
.mobile-nav-drawer::-webkit-scrollbar-track { background: transparent; }
.mobile-nav-drawer::-webkit-scrollbar-thumb { background: rgba(99,58,133,0.3); border-radius: 2px; }

/* ---- Drawer: Header row ----------------------------------- */
.drawer-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(99, 58, 133, 0.2);
  background: rgba(8, 8, 8, 0.98);
  position: sticky;
  top: 0;
  z-index: 2;
  flex-shrink: 0;
}
.drawer-brand {
  font-family: 'Rubik', sans-serif;
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #633a85;
  text-decoration: none;
  line-height: 1;
}
.drawer-brand span {
  color: #A89FA0;
  font-weight: 400;
}
.drawer-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: none;
  border: none;
  cursor: pointer;
  color: #A89FA0;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
}
.drawer-close-btn:hover {
  background: rgba(99, 58, 133, 0.15);
  color: #E8E6E1;
}
.drawer-close-btn:focus { outline: none; }

/* ---- Drawer: Body ----------------------------------------- */
.drawer-body {
  flex: 1;
  padding: 0.5rem 0 1.5rem;
  display: flex;
  flex-direction: column;
}

/* CTA strip at top */
.drawer-cta-strip {
  padding: 0.75rem 1.25rem 0.9rem;
  border-bottom: 1px solid rgba(99, 58, 133, 0.12);
}
.drawer-cta-strip a {
  display: block;
  text-align: center;
  background: linear-gradient(135deg, #633a85 0%, #34d2e2 100%);
  color: #ffffff;
  font-family: 'Rubik', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.75rem 1.5rem;
  border-radius: 100px;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.15s;
}
.drawer-cta-strip a:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Section header labels */
.drawer-section-divider {
  padding: 1rem 1.25rem 0.35rem;
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #5a5560;
  font-family: 'Rubik', sans-serif;
  font-weight: 600;
  border-top: 1px solid rgba(255,255,255,0.05);
  margin-top: 0.5rem;
}
.drawer-section-divider:first-child {
  border-top: none;
  margin-top: 0;
}

/* Direct links */
.drawer-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.25rem;
  color: #C8C4C9;
  text-decoration: none;
  font-size: 0.9rem;
  font-family: 'Barlow', sans-serif;
  font-weight: 400;
  transition: color 0.15s, background 0.15s;
  line-height: 1.3;
  border-left: 2px solid transparent;
}
.drawer-link:hover {
  color: #ffffff;
  background: rgba(99, 58, 133, 0.07);
  border-left-color: rgba(99, 58, 133, 0.4);
}
.drawer-link.is-current {
  color: #633a85;
  border-left-color: #633a85;
}

/* Accordion trigger buttons */
.drawer-accordion-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.75rem 1.25rem;
  background: none;
  border: none;
  border-left: 2px solid transparent;
  cursor: pointer;
  color: #C8C4C9;
  font-size: 0.9rem;
  font-family: 'Barlow', sans-serif;
  font-weight: 400;
  text-align: left;
  transition: color 0.15s, background 0.15s;
  line-height: 1.3;
}
.drawer-accordion-trigger:hover {
  color: #34d2e2;
  background: rgba(52, 210, 226, 0.04);
}
.drawer-accordion-trigger.is-open {
  color: #34d2e2;
  border-left-color: rgba(52, 210, 226, 0.4);
}
.drawer-accordion-trigger:focus { outline: none; }

.acc-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #5a5560;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s;
}
.drawer-accordion-trigger.is-open .acc-chevron {
  transform: rotate(180deg);
  color: #34d2e2;
}

/* Accordion panels */
.drawer-accordion-panel {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(0, 0, 0, 0.25);
}
.drawer-accordion-panel.is-open {
  max-height: 800px;
}

/* Sub-links inside accordion */
.drawer-sub-link {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0.6rem 1.25rem 0.6rem 1.75rem;
  color: #8A8691;
  text-decoration: none;
  font-size: 0.85rem;
  font-family: 'Barlow', sans-serif;
  font-weight: 400;
  transition: color 0.15s, background 0.15s;
  border-left: 2px solid transparent;
  line-height: 1.3;
  position: relative;
}
.drawer-sub-link::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #3d2452;
  margin-right: 0.65rem;
  flex-shrink: 0;
  transition: background 0.15s;
}
.drawer-sub-link:hover {
  color: #E8E6E1;
  background: rgba(99, 58, 133, 0.07);
  border-left-color: rgba(99, 58, 133, 0.35);
}
.drawer-sub-link:hover::before {
  background: #633a85;
}
.drawer-sub-link.is-external::after {
  content: '↗';
  font-size: 0.65rem;
  opacity: 0.45;
  margin-left: auto;
  padding-left: 0.5rem;
  flex-shrink: 0;
}
.drawer-sub-link.is-disabled {
  color: #3a3540;
  cursor: not-allowed;
  pointer-events: none;
}
.drawer-sub-link.is-disabled::before {
  background: #2a2530;
}
.coming-soon-badge {
  margin-left: auto;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #3a3540;
  border: 1px solid #2a2530;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  flex-shrink: 0;
}

/* Social links cluster */
.drawer-social-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem 0.75rem 1.75rem;
}
.drawer-social-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(99, 58, 133, 0.18);
  border-radius: 100px;
  color: #8A8691;
  font-size: 0.75rem;
  font-family: 'Barlow', sans-serif;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}
.drawer-social-pill:hover {
  background: rgba(52, 210, 226, 0.07);
  border-color: rgba(52, 210, 226, 0.3);
  color: #34d2e2;
}

/* ---- Drawer: Footer --------------------------------------- */
.drawer-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.04);
  margin-top: auto;
  flex-shrink: 0;
}
.drawer-footer p {
  font-size: 0.68rem;
  color: #3a3540;
  text-align: center;
  line-height: 1.6;
}
.drawer-footer a {
  color: #4d2e6b;
  text-decoration: none;
}
.drawer-footer a:hover {
  color: #633a85;
}

/* ---- Prevent body scroll when drawer open ---------------- */
body.drawer-open {
  overflow: hidden;
}

/* ---- Light mode overrides -------------------------------- */
@media (max-width: 768px) {
  [data-theme="light"] .mobile-header {
    background: rgba(247, 243, 239, 0.96);
    border-bottom-color: rgba(99, 58, 133, 0.2);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
  }
  [data-theme="light"] .mobile-header .mobile-logo {
    color: #633a85;
  }
  [data-theme="light"] .mobile-header .mobile-logo span {
    color: #7a6e8a;
  }
  [data-theme="light"] .hamburger-btn .ham-bar {
    background: #1a1218;
  }
}

[data-theme="light"] .mobile-nav-drawer {
  background: #ffffff;
  border-left-color: rgba(99, 58, 133, 0.2);
}
[data-theme="light"] .drawer-header-row {
  background: rgba(255, 255, 255, 0.98);
  border-bottom-color: rgba(99, 58, 133, 0.15);
}
[data-theme="light"] .drawer-brand {
  color: #633a85;
}
[data-theme="light"] .drawer-brand span {
  color: #7a6e8a;
}
[data-theme="light"] .drawer-close-btn {
  color: #5a4e6a;
}
[data-theme="light"] .drawer-close-btn:hover {
  color: #1a1218;
  background: rgba(99, 58, 133, 0.08);
}
[data-theme="light"] .mobile-nav-overlay {
  background: rgba(0, 0, 0, 0.5);
}
[data-theme="light"] .drawer-section-divider {
  color: #9a8eaa;
  border-top-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .drawer-link {
  color: #2d2535;
}
[data-theme="light"] .drawer-link:hover {
  color: #1a1218;
  background: rgba(99, 58, 133, 0.05);
}
[data-theme="light"] .drawer-link.is-current {
  color: #633a85;
}
[data-theme="light"] .drawer-accordion-trigger {
  color: #2d2535;
}
[data-theme="light"] .drawer-accordion-trigger:hover {
  color: #1a9aaa;
  background: rgba(52, 210, 226, 0.04);
}
[data-theme="light"] .drawer-accordion-trigger.is-open {
  color: #1a9aaa;
}
[data-theme="light"] .acc-chevron {
  color: #9a8eaa;
}
[data-theme="light"] .drawer-accordion-panel {
  background: rgba(99, 58, 133, 0.03);
}
[data-theme="light"] .drawer-sub-link {
  color: #5a4e6a;
}
[data-theme="light"] .drawer-sub-link:hover {
  color: #1a1218;
  background: rgba(99, 58, 133, 0.04);
}
[data-theme="light"] .drawer-sub-link.is-disabled {
  color: #b8b0c8;
}
[data-theme="light"] .coming-soon-badge {
  color: #9a8eaa;
  border-color: #d0c8e0;
}
[data-theme="light"] .drawer-social-pill {
  background: rgba(99, 58, 133, 0.04);
  border-color: rgba(99, 58, 133, 0.15);
  color: #5a4e6a;
}
[data-theme="light"] .drawer-social-pill:hover {
  background: rgba(52, 210, 226, 0.06);
  border-color: rgba(52, 210, 226, 0.35);
  color: #1a9aaa;
}
[data-theme="light"] .drawer-footer {
  border-top-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .drawer-footer p {
  color: #9a8eaa;
}
[data-theme="light"] .drawer-footer a {
  color: #633a85;
}

/* ---- Light mode: theme toggle button in mobile header ---- */
@media (max-width: 768px) {
  [data-theme="light"] #theme-toggle-mobile {
    color: #5a4e6a;
    border-color: rgba(99, 58, 133, 0.3);
  }
}
