/* V63 mobile fixes: pop-ups sit above the header and always fit the screen,
   nothing pokes past the right edge on 320px phones, form fields never
   trigger iPhone auto-zoom, and small text links get a bigger tap area. */

/* Homepage pop-ups: layer them above the sticky header (z-index 2000) so their
   close buttons are never covered, keep their stacking order, and let a pop-up
   that is taller than the screen scroll instead of being cut off. */
body.home-page .overlay { z-index: 2100; }
body.home-page .path-overlay { z-index: 2200; }
body.home-page .launch-overlay {
  z-index: 2300;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  place-items: start center;
}
body.home-page .path-overlay {
  overflow-y: auto;
  overscroll-behavior: contain;
  place-items: start center;
}
/* Auto margins center the card when it fits and pin it to the top (still
   scrollable) when it does not. */
body.home-page .launch-modal,
body.home-page .path-modal { margin: auto; }

/* While any homepage pop-up is open, the floating bottom section bar, the
   back-to-top button and the Ask JOAT tab stay out of the way. */
body.locked .section-nav,
body.locked .scroll-top,
body.locked .global-scroll-top,
body.locked .ask-tab,
body.locked .chase-pop {
  visibility: hidden !important;
  pointer-events: none !important;
}

@media (max-width: 560px) {
  body.home-page .launch-overlay { padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
}
/* Short phones (iPhone SE and similar): tighten the welcome card so its
   buttons are on screen without scrolling. */
@media (max-width: 560px) and (max-height: 700px) {
  body.home-page .launch-modal { padding: 46px 20px 20px; }
  body.home-page .launch-modal .kicker { margin-bottom: 14px; }
  body.home-page .launch-modal h2 { font-size: 34px; }
  body.home-page .launch-modal > p:not(.kicker) { margin-top: 12px; font-size: 13px; line-height: 1.55; }
  body.home-page .launch-modal .button { min-height: 46px; }
}

/* iPhone zooms into any field under 16px when tapped. */
@media (max-width: 900px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]),
  select,
  textarea { font-size: max(16px, 1em); }
}

/* 320px-wide phones: keep content inside the screen. */
@media (max-width: 400px) {
  /* Member login header: two buttons plus the wordmark did not fit. */
  .site-header .header-inner .button.ghost { padding-left: 12px; padding-right: 12px; letter-spacing: .08em; }

  /* Events: long headline words widened the single grid column. */
  .events-types-head { grid-template-columns: minmax(0, 1fr); }
  .events-types-head > * { min-width: 0; overflow-wrap: break-word; }

  /* Join the Network: the two intro panels were wider than the screen. */
  .editorial-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .editorial-grid > * { min-width: 0; overflow-wrap: break-word; }

  /* Network thank-you: the large headline stretched the card past the edge. */
  .thanks { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .thanks-card h1 { font-size: clamp(40px, 13vw, 56px); overflow-wrap: break-word; }
}

/* Bigger touch area for small text links in footers and legal rows. Vertical
   padding on inline links grows the tap area without moving the layout. */
@media (max-width: 900px) {
  footer a:not(.button),
  .legal-footer a:not(.button),
  .footer-links a:not(.button) { padding-top: 10px; padding-bottom: 10px; margin-top: -10px; margin-bottom: -10px; }
}

/* Private inquiry on phones: the dark intro panel had a fixed height, so its
   last lines and the "Use the Event Inquiry instead" link slid under the form. */
@media (max-width: 900px) {
  body.home-page .inquiry-modal { display: block; }
  body.home-page .inquiry-intro { height: auto !important; min-height: 0 !important; }
}

/* Back-to-top button fallback for pages that add the button but never loaded
   its styles (Privacy, Terms, Cookies, Accessibility, Card, Member login).
   :where() keeps this at zero specificity so existing page styles still win. */
:where(.global-scroll-top) {
  position: fixed; right: 14px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 1190;
  width: 44px; height: 44px; padding: 0;
  border: 1px solid rgba(255,247,238,.28); border-radius: 50%;
  background: var(--wine, #6f1620); color: var(--paper, #fbf8f3);
  font-size: 20px; line-height: 1; cursor: pointer;
  box-shadow: 0 12px 34px rgba(46,13,12,.26);
  opacity: 0; transform: translateY(12px); pointer-events: none; transition: .25s ease;
}
:where(.global-scroll-top.show) { opacity: 1; transform: none; pointer-events: auto; }
