/*
 * AP Adventure — mobile.css
 * Phase 1 consolidation: replaces mobile-polish.css, mobile-reset-563.css,
 * quest-mobile-fixes.css, apmnu2.css (non-drawer styles), and mobile-nav fallback rules.
 * Version: 1.0.0 (Phase 1)
 */


/* =============================================================
   1. GLOBAL MOBILE RESETS
   ============================================================= */

@media (max-width: 1000px) {
  /* Undo any padding that page builder or theme templates add to content areas */
  .site-main,
  .content-area,
  .entry-content {
    padding-left: unset;
    padding-right: unset;
  }

  .widget-area,
  .sidebar {
    display: initial;
  }
}


/* =============================================================
   2. IMAGES & MEDIA
   ============================================================= */

@media (max-width: 1000px) {
  /* Campaign map / Leaflet containers */
  .campaign-map,
  .map-wrapper,
  .map-canvas,
  .leaflet-container {
    max-width: 100%;
    width: 100%;
    overflow: visible;
  }

  .campaign-map img,
  .campaign-map canvas,
  .campaign-map svg,
  .map-wrapper img,
  .map-wrapper canvas,
  .map-wrapper svg {
    max-width: 100%;
    height: auto;
    display: block;
  }

  /* Generic page content images */
  body.page:not(.home):not(.front-page) .entry-content img {
    max-width: 100%;
    height: auto;
    display: block;
  }
}


/* =============================================================
   3. PAGE-LEVEL SPACING
   ============================================================= */

@media (max-width: 1000px) {
  /* Standard pages (About, Contact, etc.) */
  body.page:not(.home):not(.front-page) .site-main,
  body.page:not(.home):not(.front-page) .entry-content {
    padding-left: 16px;
    padding-right: 16px;
    box-sizing: border-box;
  }

  body.page:not(.home):not(.front-page) .hero {
    padding-left: 16px;
    padding-right: 16px;
  }

  /* Quest archive: keep cards on white background, no thumbnail slot */
  body.post-type-archive-quest .cards .card {
    background: #fff;
  }
}


/* =============================================================
   4. SINGLE QUEST — NAVIGATION
   ============================================================= */

body.single-quest .post-navigation.quest-nav {
  margin-top: 1.25rem;
}

body.single-quest .post-navigation .nav-links {
  display: flex;
  gap: .5rem;
  justify-content: space-between;
  flex-wrap: wrap;
}

body.single-quest .post-navigation a {
  display: inline-block;
  padding: .6rem .9rem;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, .08);
  text-decoration: none;
}

@media (max-width: 900px) {
  body.single-quest .post-navigation .nav-links {
    display: flex !important;
  }
}


/* =============================================================
   5. CONTACT FORM
   ============================================================= */

@media (max-width: 1000px) {
  .page-contact .wpcf7 form .wpcf7-response-output,
  .page-contact .nf-form-errors,
  .page-contact .form-notice,
  .page-contact .error,
  .page-contact .notice {
    font-size: 16px;
    line-height: 1.4;
    padding: 10px 12px;
    border-radius: 8px;
    margin-top: 10px;
    color: #111;
    background: #fffcdc;
    border: 1px solid #e6d84c;
    word-wrap: break-word;
    white-space: normal;
  }

  .page-contact .wpcf7-not-valid-tip {
    display: block;
    font-size: 14px;
    color: #b00020;
    margin-top: 6px;
    white-space: normal;
  }

  .page-contact input[type="text"],
  .page-contact input[type="email"],
  .page-contact input[type="url"],
  .page-contact input[type="tel"],
  .page-contact textarea,
  .page-contact select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
}


/* =============================================================
   6. MOBILE NAVIGATION DRAWER (APMNU2)
   ============================================================= */

/* Desktop: hide drawer entirely */
@media (min-width: 1001px) {
  #apmnu2-root,
  #apmnu2-check {
    display: none !important;
  }
}

@media (max-width: 1000px) {
  /* Suppress any older hamburger/panel elements outside the current drawer root */
  body :is(.apmnu-toggle, .apmnu-btn, .apmnu-overlay, .apmnu-panel, #apmnu-panel):not(#apmnu2-root *) {
    display: none !important;
  }

  /* Hide the inline header nav so only the drawer shows on mobile */
  header .nav-links,
  header nav.nav-links,
  .site-header .nav-links,
  .site-header nav,
  header .navigation,
  header .primary-nav {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
  }

  /* Hamburger toggle button (Start Here page legacy hook) */
  .ap-nav-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    z-index: 10000;
    position: relative;
  }
}

/* Hamburger button */
.apmnu2-btn {
  position: fixed;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 9999px;
  background: rgba(0, 0, 0, .85);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .28);
  z-index: 2147483000;
  cursor: pointer;
  transition: transform .12s ease;
}

html.admin-bar .apmnu2-btn {
  top: 58px;
}

.apmnu2-btn:active {
  transform: scale(.98);
}

.apmnu2-btn:before,
.apmnu2-btn:after,
.apmnu2-btn i {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 2px;
  background: #fff;
  content: "";
  border-radius: 1px;
}

.apmnu2-btn i {
  top: 50%;
  margin-top: -1px;
  display: block;
}

.apmnu2-btn:before { top: calc(50% - 6px); }
.apmnu2-btn:after  { top: calc(50% + 6px); }

/* Overlay */
.apmnu2-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 2147482000;
  display: none;
  backdrop-filter: blur(1px);
}

/* Slide-in panel */
.apmnu2-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(84vw, 360px);
  background: #0f141a;
  color: #e8eef5;
  padding: 20px 18px 28px;
  z-index: 2147482500;
  transform: translateX(100%);
  transition: transform .18s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-left: 1px solid rgba(255, 255, 255, .06);
  box-shadow: -8px 0 30px rgba(0, 0, 0, .35);
}

/* Open state via CSS checkbox */
.apmnu2-check:checked ~ #apmnu2-root #apmnu2-overlay { display: block; }
.apmnu2-check:checked ~ #apmnu2-root #apmnu2-panel  { transform: translateX(0); }

/* Menu list */
.apmnu2-list,
.apmnu2-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.apmnu2-list > li {
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.apmnu2-list a {
  display: block;
  padding: 13px 6px;
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
  line-height: 1.25;
}

.apmnu2-list a:hover,
.apmnu2-list a:focus {
  background: rgba(255, 255, 255, .06);
  text-decoration: none;
  outline: none;
}

/* CTA item in drawer */
.apmnu2-list a.nav-cta {
  background: #0a6;
  color: #fff;
  text-align: center;
  margin-top: 8px;
}

.apmnu2-list a.nav-cta:hover {
  filter: brightness(1.08);
}
