/* Hidden by default — shown only on small viewports */
.bh-mobile-ham, .bh-mobile-drawer { display: none; }

/* Mobile tap-target floor: bump small interactive elements to 44px without
   changing their visual size on desktop. Applies only at <=768px. */
@media (max-width: 768px) {
  /* Footer links: padding turns 33px text into ~49px tap area. Gap is set
     by the parent flex container so this is invisible to layout. */
  footer a {
    padding: 10px 6px !important;
    margin: -10px -6px !important;
  }
  /* Skip-to-content link: pad up to 44px */
  .bh-skip {
    padding: 14px 18px !important;
  }
  /* Nav brand link (Boffin Hub logo + wordmark): bump to 44px tap area */
  nav > a:first-child,
  nav > div > a:first-child {
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
  }
}

@media (max-width: 768px) {
  /* Hide every <div> directly inside nav (links + CTA cluster) */
  nav > div { display: none !important; }
  /* …except when a div is the drawer and the menu is open */
  nav.bh-mobile-open > .bh-mobile-drawer { display: flex !important; }
  /* Logo (the <a> with the SVG) keeps its own width — keep nav itself laid out */
  nav { justify-content: space-between !important; }

  /* Hamburger pinned top-right, always above content.
     Min 44x44 hit area for tap-target a11y; visual icon stays small. */
  .bh-mobile-ham {
    display: flex !important;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 14px 11px;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    position: absolute !important;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 201;
  }
  .bh-mobile-ham span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--ink, #1A1108);
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
  }
  nav.bh-mobile-open .bh-mobile-ham span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  nav.bh-mobile-open .bh-mobile-ham span:nth-child(2) { opacity: 0; }
  nav.bh-mobile-open .bh-mobile-ham span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  /* Drawer */
  .bh-mobile-drawer {
    display: none;
    position: fixed;
    top: 64px; left: 0; right: 0;
    background: rgba(245, 239, 227, 0.98);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(26, 17, 8, 0.08);
    flex-direction: column;
    padding: 16px 24px 24px;
    z-index: 199;
  }
  nav.bh-mobile-open .bh-mobile-drawer { display: flex; }
  .bh-mobile-drawer a {
    font-family: 'DM Sans', sans-serif;
    font-size: 17px;
    font-weight: 500;
    color: #1A1108 !important;
    text-decoration: none !important;
    padding: 12px 0;
    border-bottom: 1px solid rgba(26, 17, 8, 0.1);
    opacity: 1 !important;
  }
  /* Use the nav's text color so the bars stay visible on both light and dark pages */
  .bh-mobile-ham { color: inherit; }
  .bh-mobile-ham span { background: currentColor !important; }

  /* Responsive type ramp (parity with how-it-works.html) */
  h1 { font-size: clamp(38px, 9vw, 64px) !important; line-height: 1.05 !important; }
  h2 { font-size: clamp(28px, 7vw, 48px) !important; line-height: 1.1 !important; }
  h3 { font-size: 19px !important; }
  p  { font-size: 15px !important; }

  /* Collapse multi-col grids to single column */
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }

  /* Tame oversized horizontal padding from desktop layouts */
  section, footer, header, main {
    padding-left: 24px !important;
    padding-right: 24px !important;
  }

  body { overflow-x: hidden; }

  /* Min tap target for inline links/buttons */
  nav a, nav button { min-height: 40px; }
}
